{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "%config InlineBackend.figure_format = 'svg'\n",
    "\n",
    "plt.rcParams[\"font.sans-serif\"] = 'SimHei'\n",
    "plt.rcParams[\"axes.unicode_minus\"] = False"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 一台简单的预测机"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "一台机器可以将千米转化成英里，如下所示：\n",
    "``` mermaid\n",
    "    graph LR\n",
    "    A(千米) --> B[计算]\n",
    "    B --> C(英里)\n",
    "```\n",
    "> **预测器**：上述机器接收一个输入，并做出相应的预测，输出结果，称为预测器。\n",
    "\n",
    "假如我们不知道千米和英里之间的转换公式，我们所知道的就是，**两者之间的关系是线性的**。\n",
    "$$\n",
    "mile = C * kilometer\n",
    "$$\n",
    "其中，C为常数，但是我们还不知道这个常数C是多少。\n",
    "\n",
    "我们所知道的一些对应关系：\n",
    "\n",
    "| 千米 | 英里 |\n",
    "| --- | --- |\n",
    "| 0 | 0 |\n",
    "| 100 | 62.137 |\n",
    "\n",
    "**说明：其实我们可以直接用代数法计算出C的值，但我们在此并不这样做。**\n",
    "\n",
    "那么，我们应该如何计算出常数C呢？  \n",
    "首先，我们随机生成一个数值，让机器试一下，比如令C=0.5，看看会发生什么。  \n",
    "**英里 = 0.5 * 100 = 50**\n",
    "**误差值 = 真实值 - 计算值 = 62.137 - 50 = 12.137**\n",
    "\n",
    "我们知道错了，并且知道差了多少，所以我们可以使用这个误差，知道我们得到第二个、更好的C。我们知道，增加C就可以增加输出，因为让我们将C从0.5增加到0.6，得到**英里 = 0.6 * 100 = 60**，这个答案比之前更好，误差只有2.137。\n",
    "\n",
    "由于输出值60还是太小，所以微调C，令C=0.7，此时结果超过了正确答案，误差值为-7.863。因此，我们应该对C进行微调，比如令C=0.61，得到输出值61，误差1.137.\n",
    "\n",
    "因此，如果输出值越来越接近正确答案，即误差值越来越小，那么我们就不要做那么大的调整。\n",
    "\n",
    "上面整个过程，其实就是神经网络中学习的核心过程，我们训练机器，使其输出值越来越接近正确答案。我们并非像求解数学一样一步到位，精确求解问题；相反，我们尝试得到一个答案，并多次改进答案，这种方法称为**迭代**，就是持续地、一点一点地改进答案。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 分类器与预测器并无太大差别"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "通过测量，可以得到小虫子的宽度和长度，并将其绘制成散点图。\n",
    "\n",
    "（p8）\n",
    "\n",
    "可以清楚地看出，毛虫细而长，瓢虫宽而短。\n",
    "\n",
    "我们可以在图中画一条直线，如果直线可以将毛虫和瓢虫划分开来，那么这条直线就可以根据测量值对未知小虫进行分类。\n",
    "\n",
    "（p9）\n",
    "\n",
    "问题在于，我们如何得到正确的斜率呢？如何才能很好地找到划分两种小虫的分界线呢？"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 训练简单的分类器"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下表显示了两只小虫：\n",
    "\n",
    "| 实例 | 宽度 | 长度 | 小虫 |\n",
    "| --- | --- | --- | --- |\n",
    "| 1 | 3.0 | 1.0 | 瓢虫 |\n",
    "| 2 | 1.0 | 3.0 | 毛虫 |"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "两只小虫"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "def draw2insects():\n",
    "    \"\"\"\n",
    "    绘制两只已知小虫的散点图\n",
    "    \"\"\"\n",
    "    plt.scatter(1, 3)\n",
    "    plt.scatter(3, 1)\n",
    "    \n",
    "    # xy轴范围\n",
    "    plt.xlim(0, 4)\n",
    "    plt.ylim(0, 4)\n",
    "    \n",
    "    # 图表注释\n",
    "    plt.annotate(s = \"瓢虫\",\n",
    "                 xy = (1, 3),\n",
    "                 xytext = (1.5, 2.5),\n",
    "                 arrowprops=dict(arrowstyle=\"->\"))\n",
    "    plt.annotate(s = \"毛虫\",\n",
    "                 xy = (3, 1),\n",
    "                 xytext = (3.5, 1.5),\n",
    "                 arrowprops=dict(arrowstyle=\"->\"))    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\r\n",
       "<svg height=\"250.465pt\" version=\"1.1\" viewBox=\"0 0 378.7 250.465\" width=\"378.7pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       " <defs>\r\n",
       "  <style type=\"text/css\">\r\n",
       "*{stroke-linecap:butt;stroke-linejoin:round;}\r\n",
       "  </style>\r\n",
       " </defs>\r\n",
       " <g id=\"figure_1\">\r\n",
       "  <g id=\"patch_1\">\r\n",
       "   <path d=\"M 0 250.465 \r\n",
       "L 378.7 250.465 \r\n",
       "L 378.7 0 \r\n",
       "L 0 0 \r\n",
       "z\r\n",
       "\" style=\"fill:none;\"/>\r\n",
       "  </g>\r\n",
       "  <g id=\"axes_1\">\r\n",
       "   <g id=\"patch_2\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "L 29.2 10.7 \r\n",
       "z\r\n",
       "\" style=\"fill:#ffffff;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"PathCollection_1\">\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 0 3 \r\n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\n",
       "C 2.683901 1.55874 3 0.795609 3 0 \r\n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \r\n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \r\n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \r\n",
       "z\r\n",
       "\" id=\"m5ac656dad2\" style=\"stroke:#1f77b4;\"/>\r\n",
       "    </defs>\r\n",
       "    <g clip-path=\"url(#p2f3e22644d)\">\r\n",
       "     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"112.9\" xlink:href=\"#m5ac656dad2\" y=\"65.06\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"PathCollection_2\">\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 0 3 \r\n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\n",
       "C 2.683901 1.55874 3 0.795609 3 0 \r\n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \r\n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \r\n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \r\n",
       "z\r\n",
       "\" id=\"m43f164e320\" style=\"stroke:#ff7f0e;\"/>\r\n",
       "    </defs>\r\n",
       "    <g clip-path=\"url(#p2f3e22644d)\">\r\n",
       "     <use style=\"fill:#ff7f0e;stroke:#ff7f0e;\" x=\"280.3\" xlink:href=\"#m43f164e320\" y=\"173.78\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_1\">\r\n",
       "    <g id=\"xtick_1\">\r\n",
       "     <g id=\"line2d_1\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L 0 3.5 \r\n",
       "\" id=\"me22f97c271\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#me22f97c271\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_1\">\r\n",
       "      <!-- 0.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 3.125 29.296875 \r\n",
       "Q 3.90625 50 6.4375 56.046875 \r\n",
       "Q 8.984375 62.109375 13.671875 66.015625 \r\n",
       "Q 18.359375 69.921875 25.1875 69.921875 \r\n",
       "Q 32.03125 69.921875 37.109375 64.25 \r\n",
       "Q 42.1875 58.59375 43.75 50 \r\n",
       "Q 45.3125 41.40625 44.71875 30.265625 \r\n",
       "Q 44.140625 19.140625 40.8125 12.109375 \r\n",
       "Q 37.5 5.078125 30.859375 2.34375 \r\n",
       "Q 24.21875 -0.390625 17.578125 2.921875 \r\n",
       "Q 10.9375 6.25 8.203125 11.71875 \r\n",
       "Q 5.46875 17.1875 4.296875 23.234375 \r\n",
       "Q 3.125 29.296875 3.90625 50 \r\n",
       "z\r\n",
       "M 12.890625 52.734375 \r\n",
       "Q 10.546875 31.25 12.5 22.84375 \r\n",
       "Q 14.453125 14.453125 18.9375 10.9375 \r\n",
       "Q 23.4375 7.421875 28.125 9.5625 \r\n",
       "Q 32.8125 11.71875 34.953125 18.15625 \r\n",
       "Q 37.109375 24.609375 37.109375 32.21875 \r\n",
       "Q 37.109375 39.84375 36.515625 46.09375 \r\n",
       "Q 35.9375 52.34375 33 57.421875 \r\n",
       "Q 30.078125 62.5 25.1875 62.6875 \r\n",
       "Q 20.3125 62.890625 16.59375 57.8125 \r\n",
       "Q 12.890625 52.734375 10.546875 31.25 \r\n",
       "z\r\n",
       "\" id=\"SimHei-48\"/>\r\n",
       "       <path d=\"M 16.796875 1.953125 \r\n",
       "L 7.8125 1.953125 \r\n",
       "L 7.8125 10.546875 \r\n",
       "L 16.796875 10.546875 \r\n",
       "z\r\n",
       "\" id=\"SimHei-46\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(21.7 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_2\">\r\n",
       "     <g id=\"line2d_2\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"71.05\" xlink:href=\"#me22f97c271\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_2\">\r\n",
       "      <!-- 0.5 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 8.59375 20.703125 \r\n",
       "Q 11.328125 10.15625 17.96875 8.984375 \r\n",
       "Q 24.609375 7.8125 28.703125 10.34375 \r\n",
       "Q 32.8125 12.890625 34.5625 16.984375 \r\n",
       "Q 36.328125 21.09375 36.125 26.171875 \r\n",
       "Q 35.9375 31.25 33.390625 34.765625 \r\n",
       "Q 30.859375 38.28125 26.953125 39.453125 \r\n",
       "Q 23.046875 40.625 18.15625 39.453125 \r\n",
       "Q 13.28125 38.28125 10.15625 33.984375 \r\n",
       "L 3.515625 34.765625 \r\n",
       "Q 4.296875 37.109375 10.9375 68.359375 \r\n",
       "L 41.796875 68.359375 \r\n",
       "L 41.796875 61.328125 \r\n",
       "L 16.796875 61.328125 \r\n",
       "Q 14.84375 50.78125 12.890625 44.53125 \r\n",
       "Q 18.75 47.265625 23.828125 47.0625 \r\n",
       "Q 28.90625 46.875 33.59375 44.71875 \r\n",
       "Q 38.28125 42.578125 40.421875 38.859375 \r\n",
       "Q 42.578125 35.15625 43.546875 31.4375 \r\n",
       "Q 44.53125 27.734375 44.328125 23.4375 \r\n",
       "Q 44.140625 19.140625 42.578125 14.640625 \r\n",
       "Q 41.015625 10.15625 37.890625 7.21875 \r\n",
       "Q 34.765625 4.296875 30.265625 2.53125 \r\n",
       "Q 25.78125 0.78125 19.921875 1.171875 \r\n",
       "Q 14.0625 1.5625 8.78125 5.46875 \r\n",
       "Q 3.515625 9.375 1.5625 18.75 \r\n",
       "z\r\n",
       "\" id=\"SimHei-53\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(63.55 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_3\">\r\n",
       "     <g id=\"line2d_3\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"112.9\" xlink:href=\"#me22f97c271\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_3\">\r\n",
       "      <!-- 1.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 21.875 56.25 \r\n",
       "Q 16.796875 51.171875 8.984375 46.484375 \r\n",
       "L 8.984375 53.90625 \r\n",
       "Q 18.75 60.546875 25 69.53125 \r\n",
       "L 29.6875 69.53125 \r\n",
       "L 29.6875 2.34375 \r\n",
       "L 21.875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-49\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(105.4 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_4\">\r\n",
       "     <g id=\"line2d_4\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"154.75\" xlink:href=\"#me22f97c271\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_4\">\r\n",
       "      <!-- 1.5 -->\r\n",
       "      <g transform=\"translate(147.25 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_5\">\r\n",
       "     <g id=\"line2d_5\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"196.6\" xlink:href=\"#me22f97c271\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_5\">\r\n",
       "      <!-- 2.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 4.6875 3.90625 \r\n",
       "Q 5.078125 9.765625 10.15625 14.453125 \r\n",
       "Q 15.234375 19.140625 23.046875 29.09375 \r\n",
       "Q 30.859375 39.0625 33.203125 44.53125 \r\n",
       "Q 35.546875 50 34.953125 53.90625 \r\n",
       "Q 34.375 57.8125 31.25 60.34375 \r\n",
       "Q 28.125 62.890625 24.015625 62.5 \r\n",
       "Q 19.921875 62.109375 16.203125 59.375 \r\n",
       "Q 12.5 56.640625 10.546875 51.171875 \r\n",
       "L 3.125 52.34375 \r\n",
       "Q 6.25 61.328125 11.125 65.421875 \r\n",
       "Q 16.015625 69.53125 22.65625 69.921875 \r\n",
       "Q 26.5625 70.3125 29.6875 69.71875 \r\n",
       "Q 32.8125 69.140625 36.125 66.984375 \r\n",
       "Q 39.453125 64.84375 41.59375 60.546875 \r\n",
       "Q 43.75 56.25 43.15625 50.1875 \r\n",
       "Q 42.578125 44.140625 37.109375 35.734375 \r\n",
       "Q 31.640625 27.34375 16.015625 9.375 \r\n",
       "L 44.140625 9.375 \r\n",
       "L 44.140625 2.34375 \r\n",
       "L 4.6875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-50\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(189.1 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_6\">\r\n",
       "     <g id=\"line2d_6\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"238.45\" xlink:href=\"#me22f97c271\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_6\">\r\n",
       "      <!-- 2.5 -->\r\n",
       "      <g transform=\"translate(230.95 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_7\">\r\n",
       "     <g id=\"line2d_7\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"280.3\" xlink:href=\"#me22f97c271\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_7\">\r\n",
       "      <!-- 3.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 3.90625 19.140625 \r\n",
       "L 10.9375 20.3125 \r\n",
       "Q 12.5 15.234375 16.015625 11.90625 \r\n",
       "Q 19.53125 8.59375 24.796875 8.78125 \r\n",
       "Q 30.078125 8.984375 33.203125 13.078125 \r\n",
       "Q 36.328125 17.1875 35.9375 22.453125 \r\n",
       "Q 35.546875 27.734375 31.828125 30.65625 \r\n",
       "Q 28.125 33.59375 19.921875 34.765625 \r\n",
       "L 19.921875 39.84375 \r\n",
       "Q 28.125 40.625 31.828125 44.140625 \r\n",
       "Q 35.546875 47.65625 35.15625 53.3125 \r\n",
       "Q 34.765625 58.984375 30.078125 61.515625 \r\n",
       "Q 25.390625 64.0625 20.109375 62.109375 \r\n",
       "Q 14.84375 60.15625 11.71875 51.171875 \r\n",
       "L 4.6875 52.34375 \r\n",
       "Q 7.03125 59.375 11.125 64.0625 \r\n",
       "Q 15.234375 68.75 22.265625 69.53125 \r\n",
       "Q 29.296875 70.3125 34.5625 67.765625 \r\n",
       "Q 39.84375 65.234375 41.984375 59.953125 \r\n",
       "Q 44.140625 54.6875 42.578125 48.4375 \r\n",
       "Q 41.015625 42.1875 33.59375 37.5 \r\n",
       "Q 39.0625 35.15625 41.984375 30.46875 \r\n",
       "Q 44.921875 25.78125 43.9375 18.15625 \r\n",
       "Q 42.96875 10.546875 37.109375 5.859375 \r\n",
       "Q 31.25 1.171875 23.828125 1.359375 \r\n",
       "Q 16.40625 1.5625 10.9375 6.046875 \r\n",
       "Q 5.46875 10.546875 3.90625 19.140625 \r\n",
       "z\r\n",
       "\" id=\"SimHei-51\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(272.8 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_8\">\r\n",
       "     <g id=\"line2d_8\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"322.15\" xlink:href=\"#me22f97c271\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_8\">\r\n",
       "      <!-- 3.5 -->\r\n",
       "      <g transform=\"translate(314.65 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_9\">\r\n",
       "     <g id=\"line2d_9\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"364\" xlink:href=\"#me22f97c271\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_9\">\r\n",
       "      <!-- 4.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 31.25 17.1875 \r\n",
       "L 1.171875 17.1875 \r\n",
       "L 1.171875 23.828125 \r\n",
       "L 32.8125 69.53125 \r\n",
       "L 38.671875 69.53125 \r\n",
       "L 38.671875 23.828125 \r\n",
       "L 48.046875 23.828125 \r\n",
       "L 48.046875 17.1875 \r\n",
       "L 38.671875 17.1875 \r\n",
       "L 38.671875 2.34375 \r\n",
       "L 31.25 2.34375 \r\n",
       "z\r\n",
       "M 31.25 23.828125 \r\n",
       "L 31.25 54.6875 \r\n",
       "L 9.375 23.828125 \r\n",
       "z\r\n",
       "\" id=\"SimHei-52\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(356.5 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-52\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_2\">\r\n",
       "    <g id=\"ytick_1\">\r\n",
       "     <g id=\"line2d_10\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L -3.5 0 \r\n",
       "\" id=\"maab98fe0d6\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#maab98fe0d6\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_10\">\r\n",
       "      <!-- 0.0 -->\r\n",
       "      <g transform=\"translate(7.2 231.5775)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_2\">\r\n",
       "     <g id=\"line2d_11\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#maab98fe0d6\" y=\"200.96\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_11\">\r\n",
       "      <!-- 0.5 -->\r\n",
       "      <g transform=\"translate(7.2 204.3975)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_3\">\r\n",
       "     <g id=\"line2d_12\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#maab98fe0d6\" y=\"173.78\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_12\">\r\n",
       "      <!-- 1.0 -->\r\n",
       "      <g transform=\"translate(7.2 177.2175)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_4\">\r\n",
       "     <g id=\"line2d_13\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#maab98fe0d6\" y=\"146.6\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_13\">\r\n",
       "      <!-- 1.5 -->\r\n",
       "      <g transform=\"translate(7.2 150.0375)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_5\">\r\n",
       "     <g id=\"line2d_14\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#maab98fe0d6\" y=\"119.42\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_14\">\r\n",
       "      <!-- 2.0 -->\r\n",
       "      <g transform=\"translate(7.2 122.8575)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_6\">\r\n",
       "     <g id=\"line2d_15\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#maab98fe0d6\" y=\"92.24\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_15\">\r\n",
       "      <!-- 2.5 -->\r\n",
       "      <g transform=\"translate(7.2 95.6775)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_7\">\r\n",
       "     <g id=\"line2d_16\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#maab98fe0d6\" y=\"65.06\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_16\">\r\n",
       "      <!-- 3.0 -->\r\n",
       "      <g transform=\"translate(7.2 68.4975)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_8\">\r\n",
       "     <g id=\"line2d_17\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#maab98fe0d6\" y=\"37.88\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_17\">\r\n",
       "      <!-- 3.5 -->\r\n",
       "      <g transform=\"translate(7.2 41.3175)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_9\">\r\n",
       "     <g id=\"line2d_18\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#maab98fe0d6\" y=\"10.7\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_18\">\r\n",
       "      <!-- 4.0 -->\r\n",
       "      <g transform=\"translate(7.2 14.1375)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-52\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_3\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 29.2 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_4\">\r\n",
       "    <path d=\"M 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_5\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_6\">\r\n",
       "    <path d=\"M 29.2 10.7 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_7\">\r\n",
       "    <path d=\"M 150.935709 82.505489 \r\n",
       "Q 132.826728 74.199609 115.733986 66.359838 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "    <path d=\"M 118.535993 69.845345 \r\n",
       "L 115.733986 66.359838 \r\n",
       "L 120.203595 66.209537 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"text_19\">\r\n",
       "    <!-- 瓢虫 -->\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 59.765625 70.703125 \r\n",
       "Q 59.765625 36.71875 58.984375 26.953125 \r\n",
       "Q 58.203125 17.1875 56.640625 8.203125 \r\n",
       "Q 55.078125 -0.78125 50.78125 -10.546875 \r\n",
       "Q 46.875 -7.8125 42.96875 -7.03125 \r\n",
       "Q 49.21875 0 51.359375 16.40625 \r\n",
       "Q 53.515625 32.8125 53.515625 50 \r\n",
       "L 53.515625 75 \r\n",
       "Q 61.71875 75.390625 72.265625 77.140625 \r\n",
       "Q 82.8125 78.90625 87.109375 82.03125 \r\n",
       "Q 89.453125 77.734375 92.578125 74.21875 \r\n",
       "Q 88.28125 73.828125 82.8125 72.65625 \r\n",
       "Q 83.203125 44.53125 84.765625 33.59375 \r\n",
       "Q 86.328125 22.65625 88.671875 12.6875 \r\n",
       "Q 91.015625 2.734375 96.875 -5.859375 \r\n",
       "Q 91.796875 -6.640625 89.453125 -9.765625 \r\n",
       "Q 83.984375 0.78125 81.046875 15.8125 \r\n",
       "Q 78.125 30.859375 77.34375 43.546875 \r\n",
       "Q 76.5625 56.25 76.5625 71.875 \r\n",
       "Q 73.046875 71.484375 71.09375 71.484375 \r\n",
       "L 71.09375 2.34375 \r\n",
       "L 74.609375 3.515625 \r\n",
       "Q 73.4375 7.421875 72.265625 9.375 \r\n",
       "Q 75 10.546875 77.34375 11.71875 \r\n",
       "Q 79.296875 8.203125 81.25 3.703125 \r\n",
       "Q 83.203125 -0.78125 84.765625 -4.296875 \r\n",
       "L 78.515625 -7.421875 \r\n",
       "Q 77.34375 -3.515625 76.5625 -1.5625 \r\n",
       "Q 68.75 -4.296875 65.234375 -7.03125 \r\n",
       "L 61.71875 -1.171875 \r\n",
       "Q 64.453125 0 64.84375 5.46875 \r\n",
       "L 64.84375 71.09375 \r\n",
       "Q 60.9375 70.703125 59.765625 70.703125 \r\n",
       "z\r\n",
       "M 6.25 77.34375 \r\n",
       "Q 10.9375 76.953125 15.625 76.953125 \r\n",
       "L 39.0625 76.953125 \r\n",
       "Q 44.140625 76.953125 48.828125 77.34375 \r\n",
       "L 48.828125 71.484375 \r\n",
       "Q 45.3125 71.875 35.9375 71.875 \r\n",
       "L 35.9375 62.5 \r\n",
       "L 48.4375 62.5 \r\n",
       "Q 48.046875 57.421875 48.046875 52.34375 \r\n",
       "Q 48.046875 47.265625 48.4375 41.40625 \r\n",
       "L 6.640625 41.40625 \r\n",
       "Q 7.03125 46.875 7.03125 51.5625 \r\n",
       "Q 7.03125 56.640625 6.640625 62.5 \r\n",
       "L 18.75 62.5 \r\n",
       "L 18.75 71.875 \r\n",
       "Q 10.9375 71.875 6.25 71.484375 \r\n",
       "z\r\n",
       "M 47.265625 17.578125 \r\n",
       "Q 43.359375 17.96875 38.671875 17.96875 \r\n",
       "L 31.25 17.96875 \r\n",
       "L 31.25 -3.515625 \r\n",
       "Q 31.25 -7.421875 28.125 -8.984375 \r\n",
       "Q 25 -10.546875 20.3125 -10.9375 \r\n",
       "Q 19.921875 -6.640625 17.578125 -3.125 \r\n",
       "Q 24.609375 -3.90625 25 -1.171875 \r\n",
       "L 25 17.96875 \r\n",
       "L 17.578125 17.96875 \r\n",
       "Q 12.5 17.96875 7.03125 17.578125 \r\n",
       "L 7.03125 23.828125 \r\n",
       "Q 12.890625 23.4375 17.578125 23.4375 \r\n",
       "L 38.671875 23.4375 \r\n",
       "Q 43.359375 23.4375 47.265625 23.828125 \r\n",
       "z\r\n",
       "M 35.15625 35.546875 \r\n",
       "Q 39.453125 35.546875 43.359375 35.9375 \r\n",
       "L 43.359375 29.296875 \r\n",
       "Q 39.453125 30.078125 35.15625 30.078125 \r\n",
       "L 19.921875 30.078125 \r\n",
       "Q 16.015625 30.078125 12.109375 29.296875 \r\n",
       "L 12.109375 35.9375 \r\n",
       "Q 16.015625 35.546875 19.53125 35.546875 \r\n",
       "z\r\n",
       "M 4.6875 -1.5625 \r\n",
       "Q 6.640625 0.390625 9.375 4.875 \r\n",
       "Q 12.109375 9.375 13.671875 13.28125 \r\n",
       "Q 16.015625 11.71875 19.921875 10.15625 \r\n",
       "Q 18.359375 7.8125 16.203125 4.296875 \r\n",
       "Q 14.0625 0.78125 10.15625 -5.078125 \r\n",
       "Q 7.8125 -3.125 4.6875 -1.5625 \r\n",
       "z\r\n",
       "M 41.40625 -1.171875 \r\n",
       "Q 38.28125 5.078125 33.984375 10.15625 \r\n",
       "Q 36.328125 11.71875 38.28125 14.0625 \r\n",
       "Q 43.75 7.8125 46.875 3.125 \r\n",
       "Q 44.140625 1.171875 41.40625 -1.171875 \r\n",
       "z\r\n",
       "M 30.078125 47.265625 \r\n",
       "L 30.078125 57.421875 \r\n",
       "L 24.609375 57.421875 \r\n",
       "L 24.609375 47.265625 \r\n",
       "z\r\n",
       "M 41.40625 47.265625 \r\n",
       "L 41.40625 57.421875 \r\n",
       "L 35.9375 57.421875 \r\n",
       "L 35.9375 47.265625 \r\n",
       "z\r\n",
       "M 18.75 47.265625 \r\n",
       "L 18.75 57.421875 \r\n",
       "L 13.671875 57.421875 \r\n",
       "L 13.671875 47.265625 \r\n",
       "z\r\n",
       "M 30.078125 62.5 \r\n",
       "L 30.078125 71.875 \r\n",
       "L 24.609375 71.875 \r\n",
       "L 24.609375 62.5 \r\n",
       "z\r\n",
       "\" id=\"SimHei-29922\"/>\r\n",
       "     <path d=\"M 44.921875 70.3125 \r\n",
       "Q 44.921875 74.609375 44.53125 80.46875 \r\n",
       "L 53.125 80.46875 \r\n",
       "Q 52.734375 75.78125 52.734375 70.703125 \r\n",
       "L 52.734375 60.546875 \r\n",
       "L 84.375 60.546875 \r\n",
       "Q 83.984375 52.34375 83.984375 46.09375 \r\n",
       "L 83.984375 33.984375 \r\n",
       "Q 83.984375 27.734375 84.375 20.703125 \r\n",
       "L 76.5625 20.703125 \r\n",
       "L 76.5625 24.609375 \r\n",
       "L 52.734375 24.609375 \r\n",
       "L 52.734375 2.734375 \r\n",
       "Q 67.1875 3.515625 78.90625 4.6875 \r\n",
       "Q 76.171875 9.375 72.265625 14.0625 \r\n",
       "Q 76.171875 16.015625 78.90625 18.359375 \r\n",
       "Q 87.890625 6.640625 96.09375 -5.078125 \r\n",
       "Q 90.625 -7.8125 87.890625 -9.765625 \r\n",
       "Q 85.546875 -5.46875 82.8125 -1.171875 \r\n",
       "Q 64.453125 -2.734375 54.875 -3.515625 \r\n",
       "Q 45.3125 -4.296875 34.171875 -5.265625 \r\n",
       "Q 23.046875 -6.25 7.421875 -8.59375 \r\n",
       "Q 5.46875 -2.34375 4.6875 0 \r\n",
       "Q 12.5 0 24.796875 0.78125 \r\n",
       "Q 37.109375 1.5625 44.921875 1.953125 \r\n",
       "L 44.921875 24.609375 \r\n",
       "L 21.09375 24.609375 \r\n",
       "L 21.09375 18.75 \r\n",
       "L 12.890625 18.75 \r\n",
       "Q 13.28125 25.78125 13.28125 33.203125 \r\n",
       "L 13.28125 46.875 \r\n",
       "Q 13.28125 53.125 12.890625 60.546875 \r\n",
       "L 44.921875 60.546875 \r\n",
       "z\r\n",
       "M 76.5625 31.25 \r\n",
       "L 76.5625 53.90625 \r\n",
       "L 52.734375 53.90625 \r\n",
       "L 52.734375 31.25 \r\n",
       "z\r\n",
       "M 44.921875 31.25 \r\n",
       "L 44.921875 53.90625 \r\n",
       "L 21.09375 53.90625 \r\n",
       "L 21.09375 31.25 \r\n",
       "z\r\n",
       "\" id=\"SimHei-34411\"/>\r\n",
       "    </defs>\r\n",
       "    <g transform=\"translate(154.75 92.24)scale(0.1 -0.1)\">\r\n",
       "     <use xlink:href=\"#SimHei-29922\"/>\r\n",
       "     <use x=\"100\" xlink:href=\"#SimHei-34411\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_8\">\r\n",
       "    <path d=\"M 319.333873 150.862774 \r\n",
       "Q 300.678188 161.815736 282.986648 172.202639 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "    <path d=\"M 287.448678 171.902154 \r\n",
       "L 282.986648 172.202639 \r\n",
       "L 285.423479 168.452724 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"text_20\">\r\n",
       "    <!-- 毛虫 -->\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 81.25 71.09375 \r\n",
       "Q 74.609375 70.3125 69.140625 69.140625 \r\n",
       "Q 63.671875 67.96875 48.046875 65.234375 \r\n",
       "L 48.046875 49.609375 \r\n",
       "Q 54.6875 50.78125 78.125 55.078125 \r\n",
       "L 79.296875 47.65625 \r\n",
       "Q 57.03125 44.53125 48.4375 42.578125 \r\n",
       "L 48.4375 29.6875 \r\n",
       "Q 69.140625 32.421875 87.890625 35.9375 \r\n",
       "L 88.671875 27.734375 \r\n",
       "Q 69.140625 25.390625 48.4375 21.875 \r\n",
       "L 48.4375 5.078125 \r\n",
       "Q 48.4375 -1.171875 54.296875 -1.171875 \r\n",
       "L 75.390625 -1.171875 \r\n",
       "Q 79.296875 -1.171875 81.828125 1.75 \r\n",
       "Q 84.375 4.6875 85.15625 12.5 \r\n",
       "Q 89.0625 9.765625 94.140625 7.8125 \r\n",
       "Q 91.40625 -0.78125 88.671875 -3.90625 \r\n",
       "Q 85.9375 -7.03125 78.90625 -7.8125 \r\n",
       "L 51.5625 -7.8125 \r\n",
       "Q 40.625 -7.8125 40.625 2.734375 \r\n",
       "L 40.625 21.09375 \r\n",
       "Q 20.703125 17.96875 15.8125 17.1875 \r\n",
       "Q 10.9375 16.40625 6.25 15.625 \r\n",
       "L 5.078125 23.828125 \r\n",
       "Q 17.1875 25 26.359375 26.359375 \r\n",
       "Q 35.546875 27.734375 40.625 28.515625 \r\n",
       "L 40.625 41.796875 \r\n",
       "Q 22.65625 39.0625 13.28125 37.5 \r\n",
       "L 11.71875 45.3125 \r\n",
       "Q 18.75 45.703125 24.796875 46.484375 \r\n",
       "Q 30.859375 47.265625 40.234375 48.828125 \r\n",
       "L 40.234375 64.0625 \r\n",
       "Q 22.65625 61.71875 13.671875 60.9375 \r\n",
       "Q 12.890625 64.0625 10.9375 67.96875 \r\n",
       "Q 16.40625 67.96875 24.609375 68.75 \r\n",
       "Q 32.8125 69.53125 41.59375 71.09375 \r\n",
       "Q 50.390625 72.65625 60.546875 74.796875 \r\n",
       "Q 70.703125 76.953125 75.78125 79.296875 \r\n",
       "Q 77.734375 75 81.25 71.09375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-27611\"/>\r\n",
       "    </defs>\r\n",
       "    <g transform=\"translate(322.15 146.6)scale(0.1 -0.1)\">\r\n",
       "     <use xlink:href=\"#SimHei-27611\"/>\r\n",
       "     <use x=\"100\" xlink:href=\"#SimHei-34411\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "  </g>\r\n",
       " </g>\r\n",
       " <defs>\r\n",
       "  <clipPath id=\"p2f3e22644d\">\r\n",
       "   <rect height=\"217.44\" width=\"334.8\" x=\"29.2\" y=\"10.7\"/>\r\n",
       "  </clipPath>\r\n",
       " </defs>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "draw2insects()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "由于分界线是一条直线，所以我们可以设为：\n",
    "$$\n",
    "y = A * x\n",
    "$$\n",
    "由于此处的直线并非一台预测器，所以我们使用了y和x，而非长度和宽度。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "def insect_classfy(x, a):\n",
    "    \"\"\"\n",
    "    y = a * x\n",
    "    \"\"\"\n",
    "    return a * x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们先随便假设A = 0.25，分界线为y=0.25x。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 0.25\n",
    "xs = [x for x in range(5)]\n",
    "ys = [insect_classfy(x, a) for x in xs]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x8dc7080>]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\r\n",
       "<svg height=\"250.465pt\" version=\"1.1\" viewBox=\"0 0 378.7 250.465\" width=\"378.7pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       " <defs>\r\n",
       "  <style type=\"text/css\">\r\n",
       "*{stroke-linecap:butt;stroke-linejoin:round;}\r\n",
       "  </style>\r\n",
       " </defs>\r\n",
       " <g id=\"figure_1\">\r\n",
       "  <g id=\"patch_1\">\r\n",
       "   <path d=\"M 0 250.465 \r\n",
       "L 378.7 250.465 \r\n",
       "L 378.7 0 \r\n",
       "L 0 0 \r\n",
       "z\r\n",
       "\" style=\"fill:none;\"/>\r\n",
       "  </g>\r\n",
       "  <g id=\"axes_1\">\r\n",
       "   <g id=\"patch_2\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "L 29.2 10.7 \r\n",
       "z\r\n",
       "\" style=\"fill:#ffffff;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"PathCollection_1\">\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 0 3 \r\n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\n",
       "C 2.683901 1.55874 3 0.795609 3 0 \r\n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \r\n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \r\n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \r\n",
       "z\r\n",
       "\" id=\"m8d1d34be56\" style=\"stroke:#1f77b4;\"/>\r\n",
       "    </defs>\r\n",
       "    <g clip-path=\"url(#pa0e1656ff0)\">\r\n",
       "     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"112.9\" xlink:href=\"#m8d1d34be56\" y=\"65.06\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"PathCollection_2\">\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 0 3 \r\n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\n",
       "C 2.683901 1.55874 3 0.795609 3 0 \r\n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \r\n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \r\n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \r\n",
       "z\r\n",
       "\" id=\"m21b458409e\" style=\"stroke:#ff7f0e;\"/>\r\n",
       "    </defs>\r\n",
       "    <g clip-path=\"url(#pa0e1656ff0)\">\r\n",
       "     <use style=\"fill:#ff7f0e;stroke:#ff7f0e;\" x=\"280.3\" xlink:href=\"#m21b458409e\" y=\"173.78\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_1\">\r\n",
       "    <g id=\"xtick_1\">\r\n",
       "     <g id=\"line2d_1\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L 0 3.5 \r\n",
       "\" id=\"mcbc9fa5b67\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mcbc9fa5b67\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_1\">\r\n",
       "      <!-- 0.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 3.125 29.296875 \r\n",
       "Q 3.90625 50 6.4375 56.046875 \r\n",
       "Q 8.984375 62.109375 13.671875 66.015625 \r\n",
       "Q 18.359375 69.921875 25.1875 69.921875 \r\n",
       "Q 32.03125 69.921875 37.109375 64.25 \r\n",
       "Q 42.1875 58.59375 43.75 50 \r\n",
       "Q 45.3125 41.40625 44.71875 30.265625 \r\n",
       "Q 44.140625 19.140625 40.8125 12.109375 \r\n",
       "Q 37.5 5.078125 30.859375 2.34375 \r\n",
       "Q 24.21875 -0.390625 17.578125 2.921875 \r\n",
       "Q 10.9375 6.25 8.203125 11.71875 \r\n",
       "Q 5.46875 17.1875 4.296875 23.234375 \r\n",
       "Q 3.125 29.296875 3.90625 50 \r\n",
       "z\r\n",
       "M 12.890625 52.734375 \r\n",
       "Q 10.546875 31.25 12.5 22.84375 \r\n",
       "Q 14.453125 14.453125 18.9375 10.9375 \r\n",
       "Q 23.4375 7.421875 28.125 9.5625 \r\n",
       "Q 32.8125 11.71875 34.953125 18.15625 \r\n",
       "Q 37.109375 24.609375 37.109375 32.21875 \r\n",
       "Q 37.109375 39.84375 36.515625 46.09375 \r\n",
       "Q 35.9375 52.34375 33 57.421875 \r\n",
       "Q 30.078125 62.5 25.1875 62.6875 \r\n",
       "Q 20.3125 62.890625 16.59375 57.8125 \r\n",
       "Q 12.890625 52.734375 10.546875 31.25 \r\n",
       "z\r\n",
       "\" id=\"SimHei-48\"/>\r\n",
       "       <path d=\"M 16.796875 1.953125 \r\n",
       "L 7.8125 1.953125 \r\n",
       "L 7.8125 10.546875 \r\n",
       "L 16.796875 10.546875 \r\n",
       "z\r\n",
       "\" id=\"SimHei-46\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(21.7 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_2\">\r\n",
       "     <g id=\"line2d_2\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"71.05\" xlink:href=\"#mcbc9fa5b67\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_2\">\r\n",
       "      <!-- 0.5 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 8.59375 20.703125 \r\n",
       "Q 11.328125 10.15625 17.96875 8.984375 \r\n",
       "Q 24.609375 7.8125 28.703125 10.34375 \r\n",
       "Q 32.8125 12.890625 34.5625 16.984375 \r\n",
       "Q 36.328125 21.09375 36.125 26.171875 \r\n",
       "Q 35.9375 31.25 33.390625 34.765625 \r\n",
       "Q 30.859375 38.28125 26.953125 39.453125 \r\n",
       "Q 23.046875 40.625 18.15625 39.453125 \r\n",
       "Q 13.28125 38.28125 10.15625 33.984375 \r\n",
       "L 3.515625 34.765625 \r\n",
       "Q 4.296875 37.109375 10.9375 68.359375 \r\n",
       "L 41.796875 68.359375 \r\n",
       "L 41.796875 61.328125 \r\n",
       "L 16.796875 61.328125 \r\n",
       "Q 14.84375 50.78125 12.890625 44.53125 \r\n",
       "Q 18.75 47.265625 23.828125 47.0625 \r\n",
       "Q 28.90625 46.875 33.59375 44.71875 \r\n",
       "Q 38.28125 42.578125 40.421875 38.859375 \r\n",
       "Q 42.578125 35.15625 43.546875 31.4375 \r\n",
       "Q 44.53125 27.734375 44.328125 23.4375 \r\n",
       "Q 44.140625 19.140625 42.578125 14.640625 \r\n",
       "Q 41.015625 10.15625 37.890625 7.21875 \r\n",
       "Q 34.765625 4.296875 30.265625 2.53125 \r\n",
       "Q 25.78125 0.78125 19.921875 1.171875 \r\n",
       "Q 14.0625 1.5625 8.78125 5.46875 \r\n",
       "Q 3.515625 9.375 1.5625 18.75 \r\n",
       "z\r\n",
       "\" id=\"SimHei-53\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(63.55 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_3\">\r\n",
       "     <g id=\"line2d_3\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"112.9\" xlink:href=\"#mcbc9fa5b67\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_3\">\r\n",
       "      <!-- 1.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 21.875 56.25 \r\n",
       "Q 16.796875 51.171875 8.984375 46.484375 \r\n",
       "L 8.984375 53.90625 \r\n",
       "Q 18.75 60.546875 25 69.53125 \r\n",
       "L 29.6875 69.53125 \r\n",
       "L 29.6875 2.34375 \r\n",
       "L 21.875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-49\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(105.4 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_4\">\r\n",
       "     <g id=\"line2d_4\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"154.75\" xlink:href=\"#mcbc9fa5b67\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_4\">\r\n",
       "      <!-- 1.5 -->\r\n",
       "      <g transform=\"translate(147.25 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_5\">\r\n",
       "     <g id=\"line2d_5\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"196.6\" xlink:href=\"#mcbc9fa5b67\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_5\">\r\n",
       "      <!-- 2.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 4.6875 3.90625 \r\n",
       "Q 5.078125 9.765625 10.15625 14.453125 \r\n",
       "Q 15.234375 19.140625 23.046875 29.09375 \r\n",
       "Q 30.859375 39.0625 33.203125 44.53125 \r\n",
       "Q 35.546875 50 34.953125 53.90625 \r\n",
       "Q 34.375 57.8125 31.25 60.34375 \r\n",
       "Q 28.125 62.890625 24.015625 62.5 \r\n",
       "Q 19.921875 62.109375 16.203125 59.375 \r\n",
       "Q 12.5 56.640625 10.546875 51.171875 \r\n",
       "L 3.125 52.34375 \r\n",
       "Q 6.25 61.328125 11.125 65.421875 \r\n",
       "Q 16.015625 69.53125 22.65625 69.921875 \r\n",
       "Q 26.5625 70.3125 29.6875 69.71875 \r\n",
       "Q 32.8125 69.140625 36.125 66.984375 \r\n",
       "Q 39.453125 64.84375 41.59375 60.546875 \r\n",
       "Q 43.75 56.25 43.15625 50.1875 \r\n",
       "Q 42.578125 44.140625 37.109375 35.734375 \r\n",
       "Q 31.640625 27.34375 16.015625 9.375 \r\n",
       "L 44.140625 9.375 \r\n",
       "L 44.140625 2.34375 \r\n",
       "L 4.6875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-50\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(189.1 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_6\">\r\n",
       "     <g id=\"line2d_6\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"238.45\" xlink:href=\"#mcbc9fa5b67\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_6\">\r\n",
       "      <!-- 2.5 -->\r\n",
       "      <g transform=\"translate(230.95 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_7\">\r\n",
       "     <g id=\"line2d_7\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"280.3\" xlink:href=\"#mcbc9fa5b67\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_7\">\r\n",
       "      <!-- 3.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 3.90625 19.140625 \r\n",
       "L 10.9375 20.3125 \r\n",
       "Q 12.5 15.234375 16.015625 11.90625 \r\n",
       "Q 19.53125 8.59375 24.796875 8.78125 \r\n",
       "Q 30.078125 8.984375 33.203125 13.078125 \r\n",
       "Q 36.328125 17.1875 35.9375 22.453125 \r\n",
       "Q 35.546875 27.734375 31.828125 30.65625 \r\n",
       "Q 28.125 33.59375 19.921875 34.765625 \r\n",
       "L 19.921875 39.84375 \r\n",
       "Q 28.125 40.625 31.828125 44.140625 \r\n",
       "Q 35.546875 47.65625 35.15625 53.3125 \r\n",
       "Q 34.765625 58.984375 30.078125 61.515625 \r\n",
       "Q 25.390625 64.0625 20.109375 62.109375 \r\n",
       "Q 14.84375 60.15625 11.71875 51.171875 \r\n",
       "L 4.6875 52.34375 \r\n",
       "Q 7.03125 59.375 11.125 64.0625 \r\n",
       "Q 15.234375 68.75 22.265625 69.53125 \r\n",
       "Q 29.296875 70.3125 34.5625 67.765625 \r\n",
       "Q 39.84375 65.234375 41.984375 59.953125 \r\n",
       "Q 44.140625 54.6875 42.578125 48.4375 \r\n",
       "Q 41.015625 42.1875 33.59375 37.5 \r\n",
       "Q 39.0625 35.15625 41.984375 30.46875 \r\n",
       "Q 44.921875 25.78125 43.9375 18.15625 \r\n",
       "Q 42.96875 10.546875 37.109375 5.859375 \r\n",
       "Q 31.25 1.171875 23.828125 1.359375 \r\n",
       "Q 16.40625 1.5625 10.9375 6.046875 \r\n",
       "Q 5.46875 10.546875 3.90625 19.140625 \r\n",
       "z\r\n",
       "\" id=\"SimHei-51\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(272.8 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_8\">\r\n",
       "     <g id=\"line2d_8\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"322.15\" xlink:href=\"#mcbc9fa5b67\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_8\">\r\n",
       "      <!-- 3.5 -->\r\n",
       "      <g transform=\"translate(314.65 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_9\">\r\n",
       "     <g id=\"line2d_9\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"364\" xlink:href=\"#mcbc9fa5b67\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_9\">\r\n",
       "      <!-- 4.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 31.25 17.1875 \r\n",
       "L 1.171875 17.1875 \r\n",
       "L 1.171875 23.828125 \r\n",
       "L 32.8125 69.53125 \r\n",
       "L 38.671875 69.53125 \r\n",
       "L 38.671875 23.828125 \r\n",
       "L 48.046875 23.828125 \r\n",
       "L 48.046875 17.1875 \r\n",
       "L 38.671875 17.1875 \r\n",
       "L 38.671875 2.34375 \r\n",
       "L 31.25 2.34375 \r\n",
       "z\r\n",
       "M 31.25 23.828125 \r\n",
       "L 31.25 54.6875 \r\n",
       "L 9.375 23.828125 \r\n",
       "z\r\n",
       "\" id=\"SimHei-52\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(356.5 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-52\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_2\">\r\n",
       "    <g id=\"ytick_1\">\r\n",
       "     <g id=\"line2d_10\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L -3.5 0 \r\n",
       "\" id=\"mfb68995ea1\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mfb68995ea1\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_10\">\r\n",
       "      <!-- 0.0 -->\r\n",
       "      <g transform=\"translate(7.2 231.5775)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_2\">\r\n",
       "     <g id=\"line2d_11\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mfb68995ea1\" y=\"200.96\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_11\">\r\n",
       "      <!-- 0.5 -->\r\n",
       "      <g transform=\"translate(7.2 204.3975)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_3\">\r\n",
       "     <g id=\"line2d_12\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mfb68995ea1\" y=\"173.78\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_12\">\r\n",
       "      <!-- 1.0 -->\r\n",
       "      <g transform=\"translate(7.2 177.2175)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_4\">\r\n",
       "     <g id=\"line2d_13\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mfb68995ea1\" y=\"146.6\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_13\">\r\n",
       "      <!-- 1.5 -->\r\n",
       "      <g transform=\"translate(7.2 150.0375)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_5\">\r\n",
       "     <g id=\"line2d_14\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mfb68995ea1\" y=\"119.42\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_14\">\r\n",
       "      <!-- 2.0 -->\r\n",
       "      <g transform=\"translate(7.2 122.8575)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_6\">\r\n",
       "     <g id=\"line2d_15\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mfb68995ea1\" y=\"92.24\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_15\">\r\n",
       "      <!-- 2.5 -->\r\n",
       "      <g transform=\"translate(7.2 95.6775)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_7\">\r\n",
       "     <g id=\"line2d_16\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mfb68995ea1\" y=\"65.06\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_16\">\r\n",
       "      <!-- 3.0 -->\r\n",
       "      <g transform=\"translate(7.2 68.4975)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_8\">\r\n",
       "     <g id=\"line2d_17\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mfb68995ea1\" y=\"37.88\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_17\">\r\n",
       "      <!-- 3.5 -->\r\n",
       "      <g transform=\"translate(7.2 41.3175)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_9\">\r\n",
       "     <g id=\"line2d_18\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mfb68995ea1\" y=\"10.7\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_18\">\r\n",
       "      <!-- 4.0 -->\r\n",
       "      <g transform=\"translate(7.2 14.1375)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-52\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"line2d_19\">\r\n",
       "    <path clip-path=\"url(#pa0e1656ff0)\" d=\"M 29.2 228.14 \r\n",
       "L 112.9 214.55 \r\n",
       "L 196.6 200.96 \r\n",
       "L 280.3 187.37 \r\n",
       "L 364 173.78 \r\n",
       "\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:square;stroke-width:1.5;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_3\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 29.2 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_4\">\r\n",
       "    <path d=\"M 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_5\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_6\">\r\n",
       "    <path d=\"M 29.2 10.7 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_7\">\r\n",
       "    <path d=\"M 150.935709 82.505489 \r\n",
       "Q 132.826728 74.199609 115.733986 66.359838 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "    <path d=\"M 118.535993 69.845345 \r\n",
       "L 115.733986 66.359838 \r\n",
       "L 120.203595 66.209537 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"text_19\">\r\n",
       "    <!-- 瓢虫 -->\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 59.765625 70.703125 \r\n",
       "Q 59.765625 36.71875 58.984375 26.953125 \r\n",
       "Q 58.203125 17.1875 56.640625 8.203125 \r\n",
       "Q 55.078125 -0.78125 50.78125 -10.546875 \r\n",
       "Q 46.875 -7.8125 42.96875 -7.03125 \r\n",
       "Q 49.21875 0 51.359375 16.40625 \r\n",
       "Q 53.515625 32.8125 53.515625 50 \r\n",
       "L 53.515625 75 \r\n",
       "Q 61.71875 75.390625 72.265625 77.140625 \r\n",
       "Q 82.8125 78.90625 87.109375 82.03125 \r\n",
       "Q 89.453125 77.734375 92.578125 74.21875 \r\n",
       "Q 88.28125 73.828125 82.8125 72.65625 \r\n",
       "Q 83.203125 44.53125 84.765625 33.59375 \r\n",
       "Q 86.328125 22.65625 88.671875 12.6875 \r\n",
       "Q 91.015625 2.734375 96.875 -5.859375 \r\n",
       "Q 91.796875 -6.640625 89.453125 -9.765625 \r\n",
       "Q 83.984375 0.78125 81.046875 15.8125 \r\n",
       "Q 78.125 30.859375 77.34375 43.546875 \r\n",
       "Q 76.5625 56.25 76.5625 71.875 \r\n",
       "Q 73.046875 71.484375 71.09375 71.484375 \r\n",
       "L 71.09375 2.34375 \r\n",
       "L 74.609375 3.515625 \r\n",
       "Q 73.4375 7.421875 72.265625 9.375 \r\n",
       "Q 75 10.546875 77.34375 11.71875 \r\n",
       "Q 79.296875 8.203125 81.25 3.703125 \r\n",
       "Q 83.203125 -0.78125 84.765625 -4.296875 \r\n",
       "L 78.515625 -7.421875 \r\n",
       "Q 77.34375 -3.515625 76.5625 -1.5625 \r\n",
       "Q 68.75 -4.296875 65.234375 -7.03125 \r\n",
       "L 61.71875 -1.171875 \r\n",
       "Q 64.453125 0 64.84375 5.46875 \r\n",
       "L 64.84375 71.09375 \r\n",
       "Q 60.9375 70.703125 59.765625 70.703125 \r\n",
       "z\r\n",
       "M 6.25 77.34375 \r\n",
       "Q 10.9375 76.953125 15.625 76.953125 \r\n",
       "L 39.0625 76.953125 \r\n",
       "Q 44.140625 76.953125 48.828125 77.34375 \r\n",
       "L 48.828125 71.484375 \r\n",
       "Q 45.3125 71.875 35.9375 71.875 \r\n",
       "L 35.9375 62.5 \r\n",
       "L 48.4375 62.5 \r\n",
       "Q 48.046875 57.421875 48.046875 52.34375 \r\n",
       "Q 48.046875 47.265625 48.4375 41.40625 \r\n",
       "L 6.640625 41.40625 \r\n",
       "Q 7.03125 46.875 7.03125 51.5625 \r\n",
       "Q 7.03125 56.640625 6.640625 62.5 \r\n",
       "L 18.75 62.5 \r\n",
       "L 18.75 71.875 \r\n",
       "Q 10.9375 71.875 6.25 71.484375 \r\n",
       "z\r\n",
       "M 47.265625 17.578125 \r\n",
       "Q 43.359375 17.96875 38.671875 17.96875 \r\n",
       "L 31.25 17.96875 \r\n",
       "L 31.25 -3.515625 \r\n",
       "Q 31.25 -7.421875 28.125 -8.984375 \r\n",
       "Q 25 -10.546875 20.3125 -10.9375 \r\n",
       "Q 19.921875 -6.640625 17.578125 -3.125 \r\n",
       "Q 24.609375 -3.90625 25 -1.171875 \r\n",
       "L 25 17.96875 \r\n",
       "L 17.578125 17.96875 \r\n",
       "Q 12.5 17.96875 7.03125 17.578125 \r\n",
       "L 7.03125 23.828125 \r\n",
       "Q 12.890625 23.4375 17.578125 23.4375 \r\n",
       "L 38.671875 23.4375 \r\n",
       "Q 43.359375 23.4375 47.265625 23.828125 \r\n",
       "z\r\n",
       "M 35.15625 35.546875 \r\n",
       "Q 39.453125 35.546875 43.359375 35.9375 \r\n",
       "L 43.359375 29.296875 \r\n",
       "Q 39.453125 30.078125 35.15625 30.078125 \r\n",
       "L 19.921875 30.078125 \r\n",
       "Q 16.015625 30.078125 12.109375 29.296875 \r\n",
       "L 12.109375 35.9375 \r\n",
       "Q 16.015625 35.546875 19.53125 35.546875 \r\n",
       "z\r\n",
       "M 4.6875 -1.5625 \r\n",
       "Q 6.640625 0.390625 9.375 4.875 \r\n",
       "Q 12.109375 9.375 13.671875 13.28125 \r\n",
       "Q 16.015625 11.71875 19.921875 10.15625 \r\n",
       "Q 18.359375 7.8125 16.203125 4.296875 \r\n",
       "Q 14.0625 0.78125 10.15625 -5.078125 \r\n",
       "Q 7.8125 -3.125 4.6875 -1.5625 \r\n",
       "z\r\n",
       "M 41.40625 -1.171875 \r\n",
       "Q 38.28125 5.078125 33.984375 10.15625 \r\n",
       "Q 36.328125 11.71875 38.28125 14.0625 \r\n",
       "Q 43.75 7.8125 46.875 3.125 \r\n",
       "Q 44.140625 1.171875 41.40625 -1.171875 \r\n",
       "z\r\n",
       "M 30.078125 47.265625 \r\n",
       "L 30.078125 57.421875 \r\n",
       "L 24.609375 57.421875 \r\n",
       "L 24.609375 47.265625 \r\n",
       "z\r\n",
       "M 41.40625 47.265625 \r\n",
       "L 41.40625 57.421875 \r\n",
       "L 35.9375 57.421875 \r\n",
       "L 35.9375 47.265625 \r\n",
       "z\r\n",
       "M 18.75 47.265625 \r\n",
       "L 18.75 57.421875 \r\n",
       "L 13.671875 57.421875 \r\n",
       "L 13.671875 47.265625 \r\n",
       "z\r\n",
       "M 30.078125 62.5 \r\n",
       "L 30.078125 71.875 \r\n",
       "L 24.609375 71.875 \r\n",
       "L 24.609375 62.5 \r\n",
       "z\r\n",
       "\" id=\"SimHei-29922\"/>\r\n",
       "     <path d=\"M 44.921875 70.3125 \r\n",
       "Q 44.921875 74.609375 44.53125 80.46875 \r\n",
       "L 53.125 80.46875 \r\n",
       "Q 52.734375 75.78125 52.734375 70.703125 \r\n",
       "L 52.734375 60.546875 \r\n",
       "L 84.375 60.546875 \r\n",
       "Q 83.984375 52.34375 83.984375 46.09375 \r\n",
       "L 83.984375 33.984375 \r\n",
       "Q 83.984375 27.734375 84.375 20.703125 \r\n",
       "L 76.5625 20.703125 \r\n",
       "L 76.5625 24.609375 \r\n",
       "L 52.734375 24.609375 \r\n",
       "L 52.734375 2.734375 \r\n",
       "Q 67.1875 3.515625 78.90625 4.6875 \r\n",
       "Q 76.171875 9.375 72.265625 14.0625 \r\n",
       "Q 76.171875 16.015625 78.90625 18.359375 \r\n",
       "Q 87.890625 6.640625 96.09375 -5.078125 \r\n",
       "Q 90.625 -7.8125 87.890625 -9.765625 \r\n",
       "Q 85.546875 -5.46875 82.8125 -1.171875 \r\n",
       "Q 64.453125 -2.734375 54.875 -3.515625 \r\n",
       "Q 45.3125 -4.296875 34.171875 -5.265625 \r\n",
       "Q 23.046875 -6.25 7.421875 -8.59375 \r\n",
       "Q 5.46875 -2.34375 4.6875 0 \r\n",
       "Q 12.5 0 24.796875 0.78125 \r\n",
       "Q 37.109375 1.5625 44.921875 1.953125 \r\n",
       "L 44.921875 24.609375 \r\n",
       "L 21.09375 24.609375 \r\n",
       "L 21.09375 18.75 \r\n",
       "L 12.890625 18.75 \r\n",
       "Q 13.28125 25.78125 13.28125 33.203125 \r\n",
       "L 13.28125 46.875 \r\n",
       "Q 13.28125 53.125 12.890625 60.546875 \r\n",
       "L 44.921875 60.546875 \r\n",
       "z\r\n",
       "M 76.5625 31.25 \r\n",
       "L 76.5625 53.90625 \r\n",
       "L 52.734375 53.90625 \r\n",
       "L 52.734375 31.25 \r\n",
       "z\r\n",
       "M 44.921875 31.25 \r\n",
       "L 44.921875 53.90625 \r\n",
       "L 21.09375 53.90625 \r\n",
       "L 21.09375 31.25 \r\n",
       "z\r\n",
       "\" id=\"SimHei-34411\"/>\r\n",
       "    </defs>\r\n",
       "    <g transform=\"translate(154.75 92.24)scale(0.1 -0.1)\">\r\n",
       "     <use xlink:href=\"#SimHei-29922\"/>\r\n",
       "     <use x=\"100\" xlink:href=\"#SimHei-34411\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_8\">\r\n",
       "    <path d=\"M 319.333873 150.862774 \r\n",
       "Q 300.678188 161.815736 282.986648 172.202639 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "    <path d=\"M 287.448678 171.902154 \r\n",
       "L 282.986648 172.202639 \r\n",
       "L 285.423479 168.452724 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"text_20\">\r\n",
       "    <!-- 毛虫 -->\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 81.25 71.09375 \r\n",
       "Q 74.609375 70.3125 69.140625 69.140625 \r\n",
       "Q 63.671875 67.96875 48.046875 65.234375 \r\n",
       "L 48.046875 49.609375 \r\n",
       "Q 54.6875 50.78125 78.125 55.078125 \r\n",
       "L 79.296875 47.65625 \r\n",
       "Q 57.03125 44.53125 48.4375 42.578125 \r\n",
       "L 48.4375 29.6875 \r\n",
       "Q 69.140625 32.421875 87.890625 35.9375 \r\n",
       "L 88.671875 27.734375 \r\n",
       "Q 69.140625 25.390625 48.4375 21.875 \r\n",
       "L 48.4375 5.078125 \r\n",
       "Q 48.4375 -1.171875 54.296875 -1.171875 \r\n",
       "L 75.390625 -1.171875 \r\n",
       "Q 79.296875 -1.171875 81.828125 1.75 \r\n",
       "Q 84.375 4.6875 85.15625 12.5 \r\n",
       "Q 89.0625 9.765625 94.140625 7.8125 \r\n",
       "Q 91.40625 -0.78125 88.671875 -3.90625 \r\n",
       "Q 85.9375 -7.03125 78.90625 -7.8125 \r\n",
       "L 51.5625 -7.8125 \r\n",
       "Q 40.625 -7.8125 40.625 2.734375 \r\n",
       "L 40.625 21.09375 \r\n",
       "Q 20.703125 17.96875 15.8125 17.1875 \r\n",
       "Q 10.9375 16.40625 6.25 15.625 \r\n",
       "L 5.078125 23.828125 \r\n",
       "Q 17.1875 25 26.359375 26.359375 \r\n",
       "Q 35.546875 27.734375 40.625 28.515625 \r\n",
       "L 40.625 41.796875 \r\n",
       "Q 22.65625 39.0625 13.28125 37.5 \r\n",
       "L 11.71875 45.3125 \r\n",
       "Q 18.75 45.703125 24.796875 46.484375 \r\n",
       "Q 30.859375 47.265625 40.234375 48.828125 \r\n",
       "L 40.234375 64.0625 \r\n",
       "Q 22.65625 61.71875 13.671875 60.9375 \r\n",
       "Q 12.890625 64.0625 10.9375 67.96875 \r\n",
       "Q 16.40625 67.96875 24.609375 68.75 \r\n",
       "Q 32.8125 69.53125 41.59375 71.09375 \r\n",
       "Q 50.390625 72.65625 60.546875 74.796875 \r\n",
       "Q 70.703125 76.953125 75.78125 79.296875 \r\n",
       "Q 77.734375 75 81.25 71.09375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-27611\"/>\r\n",
       "    </defs>\r\n",
       "    <g transform=\"translate(322.15 146.6)scale(0.1 -0.1)\">\r\n",
       "     <use xlink:href=\"#SimHei-27611\"/>\r\n",
       "     <use x=\"100\" xlink:href=\"#SimHei-34411\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "  </g>\r\n",
       " </g>\r\n",
       " <defs>\r\n",
       "  <clipPath id=\"pa0e1656ff0\">\r\n",
       "   <rect height=\"217.44\" width=\"334.8\" x=\"29.2\" y=\"10.7\"/>\r\n",
       "  </clipPath>\r\n",
       " </defs>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "draw2insects()\n",
    "plt.plot(xs, ys)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们无需做任何计算即可观察到y=0.25x不是一台和好的分类器，因为这条直线未能将两类昆虫区分开来。直观上我们知道需要将直线往上移动一点，但是我们应该找到一种可复用的算法，而非只适用于这一种情况的。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 根据第一个实例进行训练"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "第一个训练样本是宽度为3.0，长度为1.0的瓢虫，如果我们使用这个实例测试函数$y=Ax$，其中$x=3.0$，我们得到：\n",
    "$y = 0.25 * 3.0 = 0.75$  \n",
    "\n",
    "这个等式表明，对于宽度为3.0的小虫，其长度应为0.75，但是训练数据告诉我们，这个长度为1.0，因此我们知道这个数字太小了。\n",
    "\n",
    "而实际上，我们希望直线（分类器）经过瓢虫所在坐标点的上方，也就是$y>1.0$。\n",
    "因此，当$x=3.0$时，我们令$y=1.1$，当然也可以选择1.2甚至1.3，但是我们不能使用10或100这样较大的数字，因为这会使得直线在瓢虫和毛虫的上方，导致分类器没有任何作用。\n",
    "\n",
    "因此，期望的目标值是1.1，**误差值E**为：\n",
    "\n",
    "**误差值 = 期望目标值 - 实际输出值**\n",
    "$$\n",
    "E = 1.1 - 0.75 = 0.35\n",
    "$$\n",
    "\n",
    "在这个任务中，我们希望通过E来决定参数A所需改变的值，要做到这一点，我们需要知道两者的关系。\n",
    "\n",
    "**期望值t**称为目标值，为了得到t，我们需要微调A：\n",
    "$$\n",
    "t = (A + \\Delta{A})x\n",
    "$$\n",
    "\n",
    "(p15)\n",
    "插图\n",
    "\n",
    "所以，误差值E是期望值减去猜测值，即：\n",
    "$$\n",
    "E = t - y \n",
    "$$\n",
    "\n",
    "$$\n",
    "E = (A + detaA)x - Ax = (deltaA)x\n",
    "$$\n",
    "\n",
    "根据上面的公式，我们可以得到如何根据E来调节A：\n",
    "$$\n",
    "\\Delta{A} = \\frac {E} {x}\n",
    "$$\n",
    "\n",
    "误差值为0.35，$x=3.0$，使得：\n",
    "$$\n",
    "\\Delta{A} = \\frac {E}{x} = \\frac {0.35}{3.0} = 0.1167 \n",
    "$$\n",
    "\n",
    "这意味着，修正后的A值为：\n",
    "$$\n",
    "A + \\Delta{A} = 0.25 + 0.1167 = 0.3667\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x8b16f28>]"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\r\n",
       "<svg height=\"250.465pt\" version=\"1.1\" viewBox=\"0 0 378.7 250.465\" width=\"378.7pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       " <defs>\r\n",
       "  <style type=\"text/css\">\r\n",
       "*{stroke-linecap:butt;stroke-linejoin:round;}\r\n",
       "  </style>\r\n",
       " </defs>\r\n",
       " <g id=\"figure_1\">\r\n",
       "  <g id=\"patch_1\">\r\n",
       "   <path d=\"M 0 250.465 \r\n",
       "L 378.7 250.465 \r\n",
       "L 378.7 0 \r\n",
       "L 0 0 \r\n",
       "z\r\n",
       "\" style=\"fill:none;\"/>\r\n",
       "  </g>\r\n",
       "  <g id=\"axes_1\">\r\n",
       "   <g id=\"patch_2\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "L 29.2 10.7 \r\n",
       "z\r\n",
       "\" style=\"fill:#ffffff;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"PathCollection_1\">\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 0 3 \r\n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\n",
       "C 2.683901 1.55874 3 0.795609 3 0 \r\n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \r\n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \r\n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \r\n",
       "z\r\n",
       "\" id=\"me273b57604\" style=\"stroke:#1f77b4;\"/>\r\n",
       "    </defs>\r\n",
       "    <g clip-path=\"url(#p4cf73ea50e)\">\r\n",
       "     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"112.9\" xlink:href=\"#me273b57604\" y=\"65.06\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"PathCollection_2\">\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 0 3 \r\n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\n",
       "C 2.683901 1.55874 3 0.795609 3 0 \r\n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \r\n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \r\n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \r\n",
       "z\r\n",
       "\" id=\"me72d8d13d8\" style=\"stroke:#ff7f0e;\"/>\r\n",
       "    </defs>\r\n",
       "    <g clip-path=\"url(#p4cf73ea50e)\">\r\n",
       "     <use style=\"fill:#ff7f0e;stroke:#ff7f0e;\" x=\"280.3\" xlink:href=\"#me72d8d13d8\" y=\"173.78\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_1\">\r\n",
       "    <g id=\"xtick_1\">\r\n",
       "     <g id=\"line2d_1\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L 0 3.5 \r\n",
       "\" id=\"m971d7b0b0e\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m971d7b0b0e\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_1\">\r\n",
       "      <!-- 0.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 3.125 29.296875 \r\n",
       "Q 3.90625 50 6.4375 56.046875 \r\n",
       "Q 8.984375 62.109375 13.671875 66.015625 \r\n",
       "Q 18.359375 69.921875 25.1875 69.921875 \r\n",
       "Q 32.03125 69.921875 37.109375 64.25 \r\n",
       "Q 42.1875 58.59375 43.75 50 \r\n",
       "Q 45.3125 41.40625 44.71875 30.265625 \r\n",
       "Q 44.140625 19.140625 40.8125 12.109375 \r\n",
       "Q 37.5 5.078125 30.859375 2.34375 \r\n",
       "Q 24.21875 -0.390625 17.578125 2.921875 \r\n",
       "Q 10.9375 6.25 8.203125 11.71875 \r\n",
       "Q 5.46875 17.1875 4.296875 23.234375 \r\n",
       "Q 3.125 29.296875 3.90625 50 \r\n",
       "z\r\n",
       "M 12.890625 52.734375 \r\n",
       "Q 10.546875 31.25 12.5 22.84375 \r\n",
       "Q 14.453125 14.453125 18.9375 10.9375 \r\n",
       "Q 23.4375 7.421875 28.125 9.5625 \r\n",
       "Q 32.8125 11.71875 34.953125 18.15625 \r\n",
       "Q 37.109375 24.609375 37.109375 32.21875 \r\n",
       "Q 37.109375 39.84375 36.515625 46.09375 \r\n",
       "Q 35.9375 52.34375 33 57.421875 \r\n",
       "Q 30.078125 62.5 25.1875 62.6875 \r\n",
       "Q 20.3125 62.890625 16.59375 57.8125 \r\n",
       "Q 12.890625 52.734375 10.546875 31.25 \r\n",
       "z\r\n",
       "\" id=\"SimHei-48\"/>\r\n",
       "       <path d=\"M 16.796875 1.953125 \r\n",
       "L 7.8125 1.953125 \r\n",
       "L 7.8125 10.546875 \r\n",
       "L 16.796875 10.546875 \r\n",
       "z\r\n",
       "\" id=\"SimHei-46\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(21.7 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_2\">\r\n",
       "     <g id=\"line2d_2\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"71.05\" xlink:href=\"#m971d7b0b0e\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_2\">\r\n",
       "      <!-- 0.5 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 8.59375 20.703125 \r\n",
       "Q 11.328125 10.15625 17.96875 8.984375 \r\n",
       "Q 24.609375 7.8125 28.703125 10.34375 \r\n",
       "Q 32.8125 12.890625 34.5625 16.984375 \r\n",
       "Q 36.328125 21.09375 36.125 26.171875 \r\n",
       "Q 35.9375 31.25 33.390625 34.765625 \r\n",
       "Q 30.859375 38.28125 26.953125 39.453125 \r\n",
       "Q 23.046875 40.625 18.15625 39.453125 \r\n",
       "Q 13.28125 38.28125 10.15625 33.984375 \r\n",
       "L 3.515625 34.765625 \r\n",
       "Q 4.296875 37.109375 10.9375 68.359375 \r\n",
       "L 41.796875 68.359375 \r\n",
       "L 41.796875 61.328125 \r\n",
       "L 16.796875 61.328125 \r\n",
       "Q 14.84375 50.78125 12.890625 44.53125 \r\n",
       "Q 18.75 47.265625 23.828125 47.0625 \r\n",
       "Q 28.90625 46.875 33.59375 44.71875 \r\n",
       "Q 38.28125 42.578125 40.421875 38.859375 \r\n",
       "Q 42.578125 35.15625 43.546875 31.4375 \r\n",
       "Q 44.53125 27.734375 44.328125 23.4375 \r\n",
       "Q 44.140625 19.140625 42.578125 14.640625 \r\n",
       "Q 41.015625 10.15625 37.890625 7.21875 \r\n",
       "Q 34.765625 4.296875 30.265625 2.53125 \r\n",
       "Q 25.78125 0.78125 19.921875 1.171875 \r\n",
       "Q 14.0625 1.5625 8.78125 5.46875 \r\n",
       "Q 3.515625 9.375 1.5625 18.75 \r\n",
       "z\r\n",
       "\" id=\"SimHei-53\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(63.55 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_3\">\r\n",
       "     <g id=\"line2d_3\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"112.9\" xlink:href=\"#m971d7b0b0e\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_3\">\r\n",
       "      <!-- 1.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 21.875 56.25 \r\n",
       "Q 16.796875 51.171875 8.984375 46.484375 \r\n",
       "L 8.984375 53.90625 \r\n",
       "Q 18.75 60.546875 25 69.53125 \r\n",
       "L 29.6875 69.53125 \r\n",
       "L 29.6875 2.34375 \r\n",
       "L 21.875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-49\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(105.4 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_4\">\r\n",
       "     <g id=\"line2d_4\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"154.75\" xlink:href=\"#m971d7b0b0e\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_4\">\r\n",
       "      <!-- 1.5 -->\r\n",
       "      <g transform=\"translate(147.25 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_5\">\r\n",
       "     <g id=\"line2d_5\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"196.6\" xlink:href=\"#m971d7b0b0e\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_5\">\r\n",
       "      <!-- 2.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 4.6875 3.90625 \r\n",
       "Q 5.078125 9.765625 10.15625 14.453125 \r\n",
       "Q 15.234375 19.140625 23.046875 29.09375 \r\n",
       "Q 30.859375 39.0625 33.203125 44.53125 \r\n",
       "Q 35.546875 50 34.953125 53.90625 \r\n",
       "Q 34.375 57.8125 31.25 60.34375 \r\n",
       "Q 28.125 62.890625 24.015625 62.5 \r\n",
       "Q 19.921875 62.109375 16.203125 59.375 \r\n",
       "Q 12.5 56.640625 10.546875 51.171875 \r\n",
       "L 3.125 52.34375 \r\n",
       "Q 6.25 61.328125 11.125 65.421875 \r\n",
       "Q 16.015625 69.53125 22.65625 69.921875 \r\n",
       "Q 26.5625 70.3125 29.6875 69.71875 \r\n",
       "Q 32.8125 69.140625 36.125 66.984375 \r\n",
       "Q 39.453125 64.84375 41.59375 60.546875 \r\n",
       "Q 43.75 56.25 43.15625 50.1875 \r\n",
       "Q 42.578125 44.140625 37.109375 35.734375 \r\n",
       "Q 31.640625 27.34375 16.015625 9.375 \r\n",
       "L 44.140625 9.375 \r\n",
       "L 44.140625 2.34375 \r\n",
       "L 4.6875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-50\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(189.1 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_6\">\r\n",
       "     <g id=\"line2d_6\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"238.45\" xlink:href=\"#m971d7b0b0e\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_6\">\r\n",
       "      <!-- 2.5 -->\r\n",
       "      <g transform=\"translate(230.95 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_7\">\r\n",
       "     <g id=\"line2d_7\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"280.3\" xlink:href=\"#m971d7b0b0e\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_7\">\r\n",
       "      <!-- 3.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 3.90625 19.140625 \r\n",
       "L 10.9375 20.3125 \r\n",
       "Q 12.5 15.234375 16.015625 11.90625 \r\n",
       "Q 19.53125 8.59375 24.796875 8.78125 \r\n",
       "Q 30.078125 8.984375 33.203125 13.078125 \r\n",
       "Q 36.328125 17.1875 35.9375 22.453125 \r\n",
       "Q 35.546875 27.734375 31.828125 30.65625 \r\n",
       "Q 28.125 33.59375 19.921875 34.765625 \r\n",
       "L 19.921875 39.84375 \r\n",
       "Q 28.125 40.625 31.828125 44.140625 \r\n",
       "Q 35.546875 47.65625 35.15625 53.3125 \r\n",
       "Q 34.765625 58.984375 30.078125 61.515625 \r\n",
       "Q 25.390625 64.0625 20.109375 62.109375 \r\n",
       "Q 14.84375 60.15625 11.71875 51.171875 \r\n",
       "L 4.6875 52.34375 \r\n",
       "Q 7.03125 59.375 11.125 64.0625 \r\n",
       "Q 15.234375 68.75 22.265625 69.53125 \r\n",
       "Q 29.296875 70.3125 34.5625 67.765625 \r\n",
       "Q 39.84375 65.234375 41.984375 59.953125 \r\n",
       "Q 44.140625 54.6875 42.578125 48.4375 \r\n",
       "Q 41.015625 42.1875 33.59375 37.5 \r\n",
       "Q 39.0625 35.15625 41.984375 30.46875 \r\n",
       "Q 44.921875 25.78125 43.9375 18.15625 \r\n",
       "Q 42.96875 10.546875 37.109375 5.859375 \r\n",
       "Q 31.25 1.171875 23.828125 1.359375 \r\n",
       "Q 16.40625 1.5625 10.9375 6.046875 \r\n",
       "Q 5.46875 10.546875 3.90625 19.140625 \r\n",
       "z\r\n",
       "\" id=\"SimHei-51\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(272.8 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_8\">\r\n",
       "     <g id=\"line2d_8\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"322.15\" xlink:href=\"#m971d7b0b0e\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_8\">\r\n",
       "      <!-- 3.5 -->\r\n",
       "      <g transform=\"translate(314.65 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_9\">\r\n",
       "     <g id=\"line2d_9\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"364\" xlink:href=\"#m971d7b0b0e\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_9\">\r\n",
       "      <!-- 4.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 31.25 17.1875 \r\n",
       "L 1.171875 17.1875 \r\n",
       "L 1.171875 23.828125 \r\n",
       "L 32.8125 69.53125 \r\n",
       "L 38.671875 69.53125 \r\n",
       "L 38.671875 23.828125 \r\n",
       "L 48.046875 23.828125 \r\n",
       "L 48.046875 17.1875 \r\n",
       "L 38.671875 17.1875 \r\n",
       "L 38.671875 2.34375 \r\n",
       "L 31.25 2.34375 \r\n",
       "z\r\n",
       "M 31.25 23.828125 \r\n",
       "L 31.25 54.6875 \r\n",
       "L 9.375 23.828125 \r\n",
       "z\r\n",
       "\" id=\"SimHei-52\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(356.5 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-52\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_2\">\r\n",
       "    <g id=\"ytick_1\">\r\n",
       "     <g id=\"line2d_10\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L -3.5 0 \r\n",
       "\" id=\"mabee3e4813\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mabee3e4813\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_10\">\r\n",
       "      <!-- 0.0 -->\r\n",
       "      <g transform=\"translate(7.2 231.5775)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_2\">\r\n",
       "     <g id=\"line2d_11\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mabee3e4813\" y=\"200.96\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_11\">\r\n",
       "      <!-- 0.5 -->\r\n",
       "      <g transform=\"translate(7.2 204.3975)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_3\">\r\n",
       "     <g id=\"line2d_12\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mabee3e4813\" y=\"173.78\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_12\">\r\n",
       "      <!-- 1.0 -->\r\n",
       "      <g transform=\"translate(7.2 177.2175)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_4\">\r\n",
       "     <g id=\"line2d_13\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mabee3e4813\" y=\"146.6\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_13\">\r\n",
       "      <!-- 1.5 -->\r\n",
       "      <g transform=\"translate(7.2 150.0375)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_5\">\r\n",
       "     <g id=\"line2d_14\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mabee3e4813\" y=\"119.42\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_14\">\r\n",
       "      <!-- 2.0 -->\r\n",
       "      <g transform=\"translate(7.2 122.8575)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_6\">\r\n",
       "     <g id=\"line2d_15\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mabee3e4813\" y=\"92.24\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_15\">\r\n",
       "      <!-- 2.5 -->\r\n",
       "      <g transform=\"translate(7.2 95.6775)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_7\">\r\n",
       "     <g id=\"line2d_16\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mabee3e4813\" y=\"65.06\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_16\">\r\n",
       "      <!-- 3.0 -->\r\n",
       "      <g transform=\"translate(7.2 68.4975)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_8\">\r\n",
       "     <g id=\"line2d_17\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mabee3e4813\" y=\"37.88\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_17\">\r\n",
       "      <!-- 3.5 -->\r\n",
       "      <g transform=\"translate(7.2 41.3175)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_9\">\r\n",
       "     <g id=\"line2d_18\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mabee3e4813\" y=\"10.7\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_18\">\r\n",
       "      <!-- 4.0 -->\r\n",
       "      <g transform=\"translate(7.2 14.1375)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-52\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"line2d_19\">\r\n",
       "    <path clip-path=\"url(#p4cf73ea50e)\" d=\"M 29.2 228.14 \r\n",
       "L 112.9 214.55 \r\n",
       "L 196.6 200.96 \r\n",
       "L 280.3 187.37 \r\n",
       "L 364 173.78 \r\n",
       "\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:square;stroke-width:1.5;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"line2d_20\">\r\n",
       "    <path clip-path=\"url(#p4cf73ea50e)\" d=\"M 29.2 228.14 \r\n",
       "L 112.9 208.206188 \r\n",
       "L 196.6 188.272376 \r\n",
       "L 280.3 168.338564 \r\n",
       "L 364 148.404752 \r\n",
       "\" style=\"fill:none;stroke:#ff7f0e;stroke-linecap:square;stroke-width:1.5;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_3\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 29.2 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_4\">\r\n",
       "    <path d=\"M 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_5\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_6\">\r\n",
       "    <path d=\"M 29.2 10.7 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_7\">\r\n",
       "    <path d=\"M 150.935709 82.505489 \r\n",
       "Q 132.826728 74.199609 115.733986 66.359838 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "    <path d=\"M 118.535993 69.845345 \r\n",
       "L 115.733986 66.359838 \r\n",
       "L 120.203595 66.209537 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"text_19\">\r\n",
       "    <!-- 瓢虫 -->\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 59.765625 70.703125 \r\n",
       "Q 59.765625 36.71875 58.984375 26.953125 \r\n",
       "Q 58.203125 17.1875 56.640625 8.203125 \r\n",
       "Q 55.078125 -0.78125 50.78125 -10.546875 \r\n",
       "Q 46.875 -7.8125 42.96875 -7.03125 \r\n",
       "Q 49.21875 0 51.359375 16.40625 \r\n",
       "Q 53.515625 32.8125 53.515625 50 \r\n",
       "L 53.515625 75 \r\n",
       "Q 61.71875 75.390625 72.265625 77.140625 \r\n",
       "Q 82.8125 78.90625 87.109375 82.03125 \r\n",
       "Q 89.453125 77.734375 92.578125 74.21875 \r\n",
       "Q 88.28125 73.828125 82.8125 72.65625 \r\n",
       "Q 83.203125 44.53125 84.765625 33.59375 \r\n",
       "Q 86.328125 22.65625 88.671875 12.6875 \r\n",
       "Q 91.015625 2.734375 96.875 -5.859375 \r\n",
       "Q 91.796875 -6.640625 89.453125 -9.765625 \r\n",
       "Q 83.984375 0.78125 81.046875 15.8125 \r\n",
       "Q 78.125 30.859375 77.34375 43.546875 \r\n",
       "Q 76.5625 56.25 76.5625 71.875 \r\n",
       "Q 73.046875 71.484375 71.09375 71.484375 \r\n",
       "L 71.09375 2.34375 \r\n",
       "L 74.609375 3.515625 \r\n",
       "Q 73.4375 7.421875 72.265625 9.375 \r\n",
       "Q 75 10.546875 77.34375 11.71875 \r\n",
       "Q 79.296875 8.203125 81.25 3.703125 \r\n",
       "Q 83.203125 -0.78125 84.765625 -4.296875 \r\n",
       "L 78.515625 -7.421875 \r\n",
       "Q 77.34375 -3.515625 76.5625 -1.5625 \r\n",
       "Q 68.75 -4.296875 65.234375 -7.03125 \r\n",
       "L 61.71875 -1.171875 \r\n",
       "Q 64.453125 0 64.84375 5.46875 \r\n",
       "L 64.84375 71.09375 \r\n",
       "Q 60.9375 70.703125 59.765625 70.703125 \r\n",
       "z\r\n",
       "M 6.25 77.34375 \r\n",
       "Q 10.9375 76.953125 15.625 76.953125 \r\n",
       "L 39.0625 76.953125 \r\n",
       "Q 44.140625 76.953125 48.828125 77.34375 \r\n",
       "L 48.828125 71.484375 \r\n",
       "Q 45.3125 71.875 35.9375 71.875 \r\n",
       "L 35.9375 62.5 \r\n",
       "L 48.4375 62.5 \r\n",
       "Q 48.046875 57.421875 48.046875 52.34375 \r\n",
       "Q 48.046875 47.265625 48.4375 41.40625 \r\n",
       "L 6.640625 41.40625 \r\n",
       "Q 7.03125 46.875 7.03125 51.5625 \r\n",
       "Q 7.03125 56.640625 6.640625 62.5 \r\n",
       "L 18.75 62.5 \r\n",
       "L 18.75 71.875 \r\n",
       "Q 10.9375 71.875 6.25 71.484375 \r\n",
       "z\r\n",
       "M 47.265625 17.578125 \r\n",
       "Q 43.359375 17.96875 38.671875 17.96875 \r\n",
       "L 31.25 17.96875 \r\n",
       "L 31.25 -3.515625 \r\n",
       "Q 31.25 -7.421875 28.125 -8.984375 \r\n",
       "Q 25 -10.546875 20.3125 -10.9375 \r\n",
       "Q 19.921875 -6.640625 17.578125 -3.125 \r\n",
       "Q 24.609375 -3.90625 25 -1.171875 \r\n",
       "L 25 17.96875 \r\n",
       "L 17.578125 17.96875 \r\n",
       "Q 12.5 17.96875 7.03125 17.578125 \r\n",
       "L 7.03125 23.828125 \r\n",
       "Q 12.890625 23.4375 17.578125 23.4375 \r\n",
       "L 38.671875 23.4375 \r\n",
       "Q 43.359375 23.4375 47.265625 23.828125 \r\n",
       "z\r\n",
       "M 35.15625 35.546875 \r\n",
       "Q 39.453125 35.546875 43.359375 35.9375 \r\n",
       "L 43.359375 29.296875 \r\n",
       "Q 39.453125 30.078125 35.15625 30.078125 \r\n",
       "L 19.921875 30.078125 \r\n",
       "Q 16.015625 30.078125 12.109375 29.296875 \r\n",
       "L 12.109375 35.9375 \r\n",
       "Q 16.015625 35.546875 19.53125 35.546875 \r\n",
       "z\r\n",
       "M 4.6875 -1.5625 \r\n",
       "Q 6.640625 0.390625 9.375 4.875 \r\n",
       "Q 12.109375 9.375 13.671875 13.28125 \r\n",
       "Q 16.015625 11.71875 19.921875 10.15625 \r\n",
       "Q 18.359375 7.8125 16.203125 4.296875 \r\n",
       "Q 14.0625 0.78125 10.15625 -5.078125 \r\n",
       "Q 7.8125 -3.125 4.6875 -1.5625 \r\n",
       "z\r\n",
       "M 41.40625 -1.171875 \r\n",
       "Q 38.28125 5.078125 33.984375 10.15625 \r\n",
       "Q 36.328125 11.71875 38.28125 14.0625 \r\n",
       "Q 43.75 7.8125 46.875 3.125 \r\n",
       "Q 44.140625 1.171875 41.40625 -1.171875 \r\n",
       "z\r\n",
       "M 30.078125 47.265625 \r\n",
       "L 30.078125 57.421875 \r\n",
       "L 24.609375 57.421875 \r\n",
       "L 24.609375 47.265625 \r\n",
       "z\r\n",
       "M 41.40625 47.265625 \r\n",
       "L 41.40625 57.421875 \r\n",
       "L 35.9375 57.421875 \r\n",
       "L 35.9375 47.265625 \r\n",
       "z\r\n",
       "M 18.75 47.265625 \r\n",
       "L 18.75 57.421875 \r\n",
       "L 13.671875 57.421875 \r\n",
       "L 13.671875 47.265625 \r\n",
       "z\r\n",
       "M 30.078125 62.5 \r\n",
       "L 30.078125 71.875 \r\n",
       "L 24.609375 71.875 \r\n",
       "L 24.609375 62.5 \r\n",
       "z\r\n",
       "\" id=\"SimHei-29922\"/>\r\n",
       "     <path d=\"M 44.921875 70.3125 \r\n",
       "Q 44.921875 74.609375 44.53125 80.46875 \r\n",
       "L 53.125 80.46875 \r\n",
       "Q 52.734375 75.78125 52.734375 70.703125 \r\n",
       "L 52.734375 60.546875 \r\n",
       "L 84.375 60.546875 \r\n",
       "Q 83.984375 52.34375 83.984375 46.09375 \r\n",
       "L 83.984375 33.984375 \r\n",
       "Q 83.984375 27.734375 84.375 20.703125 \r\n",
       "L 76.5625 20.703125 \r\n",
       "L 76.5625 24.609375 \r\n",
       "L 52.734375 24.609375 \r\n",
       "L 52.734375 2.734375 \r\n",
       "Q 67.1875 3.515625 78.90625 4.6875 \r\n",
       "Q 76.171875 9.375 72.265625 14.0625 \r\n",
       "Q 76.171875 16.015625 78.90625 18.359375 \r\n",
       "Q 87.890625 6.640625 96.09375 -5.078125 \r\n",
       "Q 90.625 -7.8125 87.890625 -9.765625 \r\n",
       "Q 85.546875 -5.46875 82.8125 -1.171875 \r\n",
       "Q 64.453125 -2.734375 54.875 -3.515625 \r\n",
       "Q 45.3125 -4.296875 34.171875 -5.265625 \r\n",
       "Q 23.046875 -6.25 7.421875 -8.59375 \r\n",
       "Q 5.46875 -2.34375 4.6875 0 \r\n",
       "Q 12.5 0 24.796875 0.78125 \r\n",
       "Q 37.109375 1.5625 44.921875 1.953125 \r\n",
       "L 44.921875 24.609375 \r\n",
       "L 21.09375 24.609375 \r\n",
       "L 21.09375 18.75 \r\n",
       "L 12.890625 18.75 \r\n",
       "Q 13.28125 25.78125 13.28125 33.203125 \r\n",
       "L 13.28125 46.875 \r\n",
       "Q 13.28125 53.125 12.890625 60.546875 \r\n",
       "L 44.921875 60.546875 \r\n",
       "z\r\n",
       "M 76.5625 31.25 \r\n",
       "L 76.5625 53.90625 \r\n",
       "L 52.734375 53.90625 \r\n",
       "L 52.734375 31.25 \r\n",
       "z\r\n",
       "M 44.921875 31.25 \r\n",
       "L 44.921875 53.90625 \r\n",
       "L 21.09375 53.90625 \r\n",
       "L 21.09375 31.25 \r\n",
       "z\r\n",
       "\" id=\"SimHei-34411\"/>\r\n",
       "    </defs>\r\n",
       "    <g transform=\"translate(154.75 92.24)scale(0.1 -0.1)\">\r\n",
       "     <use xlink:href=\"#SimHei-29922\"/>\r\n",
       "     <use x=\"100\" xlink:href=\"#SimHei-34411\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_8\">\r\n",
       "    <path d=\"M 319.333873 150.862774 \r\n",
       "Q 300.678188 161.815736 282.986648 172.202639 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "    <path d=\"M 287.448678 171.902154 \r\n",
       "L 282.986648 172.202639 \r\n",
       "L 285.423479 168.452724 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"text_20\">\r\n",
       "    <!-- 毛虫 -->\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 81.25 71.09375 \r\n",
       "Q 74.609375 70.3125 69.140625 69.140625 \r\n",
       "Q 63.671875 67.96875 48.046875 65.234375 \r\n",
       "L 48.046875 49.609375 \r\n",
       "Q 54.6875 50.78125 78.125 55.078125 \r\n",
       "L 79.296875 47.65625 \r\n",
       "Q 57.03125 44.53125 48.4375 42.578125 \r\n",
       "L 48.4375 29.6875 \r\n",
       "Q 69.140625 32.421875 87.890625 35.9375 \r\n",
       "L 88.671875 27.734375 \r\n",
       "Q 69.140625 25.390625 48.4375 21.875 \r\n",
       "L 48.4375 5.078125 \r\n",
       "Q 48.4375 -1.171875 54.296875 -1.171875 \r\n",
       "L 75.390625 -1.171875 \r\n",
       "Q 79.296875 -1.171875 81.828125 1.75 \r\n",
       "Q 84.375 4.6875 85.15625 12.5 \r\n",
       "Q 89.0625 9.765625 94.140625 7.8125 \r\n",
       "Q 91.40625 -0.78125 88.671875 -3.90625 \r\n",
       "Q 85.9375 -7.03125 78.90625 -7.8125 \r\n",
       "L 51.5625 -7.8125 \r\n",
       "Q 40.625 -7.8125 40.625 2.734375 \r\n",
       "L 40.625 21.09375 \r\n",
       "Q 20.703125 17.96875 15.8125 17.1875 \r\n",
       "Q 10.9375 16.40625 6.25 15.625 \r\n",
       "L 5.078125 23.828125 \r\n",
       "Q 17.1875 25 26.359375 26.359375 \r\n",
       "Q 35.546875 27.734375 40.625 28.515625 \r\n",
       "L 40.625 41.796875 \r\n",
       "Q 22.65625 39.0625 13.28125 37.5 \r\n",
       "L 11.71875 45.3125 \r\n",
       "Q 18.75 45.703125 24.796875 46.484375 \r\n",
       "Q 30.859375 47.265625 40.234375 48.828125 \r\n",
       "L 40.234375 64.0625 \r\n",
       "Q 22.65625 61.71875 13.671875 60.9375 \r\n",
       "Q 12.890625 64.0625 10.9375 67.96875 \r\n",
       "Q 16.40625 67.96875 24.609375 68.75 \r\n",
       "Q 32.8125 69.53125 41.59375 71.09375 \r\n",
       "Q 50.390625 72.65625 60.546875 74.796875 \r\n",
       "Q 70.703125 76.953125 75.78125 79.296875 \r\n",
       "Q 77.734375 75 81.25 71.09375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-27611\"/>\r\n",
       "    </defs>\r\n",
       "    <g transform=\"translate(322.15 146.6)scale(0.1 -0.1)\">\r\n",
       "     <use xlink:href=\"#SimHei-27611\"/>\r\n",
       "     <use x=\"100\" xlink:href=\"#SimHei-34411\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "  </g>\r\n",
       " </g>\r\n",
       " <defs>\r\n",
       "  <clipPath id=\"p4cf73ea50e\">\r\n",
       "   <rect height=\"217.44\" width=\"334.8\" x=\"29.2\" y=\"10.7\"/>\r\n",
       "  </clipPath>\r\n",
       " </defs>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "xs = [x for x in range(5)]\n",
    "ys = [insect_classfy(x, a=0.25) for x in xs]\n",
    "ys1 = [insect_classfy(x, a=0.3667) for x in xs]\n",
    "\n",
    "draw2insects()\n",
    "plt.plot(xs, ys)\n",
    "plt.plot(xs, ys1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 根据第二个实例进行训练"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "接下来，我们按照第一个实例的训练方法，对第二个实例进行训练。已知正确值为$x = 1.0$和$y = 3.0$。\n",
    "\n",
    "当使用A = 0.3667，并把x = 1.0代入到线性函数中去，我们得到：\n",
    "$$\n",
    "y = 0.3667 * 1.0 = 0.3667\n",
    "$$\n",
    "这个结果与训练样本中的y = 3.0相去甚远。基于第一次的推理，我们希望直线不要经过训练数据，而是稍微高于或低于训练数据，我们将目标值设置为2.9.此时，误差值E为：\n",
    "$$\n",
    "E = 2.9 - 0.3667 = 2.5333\n",
    "$$\n",
    "\n",
    "此时再根据E来改进A：\n",
    "$$\n",
    "\\Delta{A} = \\frac {E}{x} = \\frac {2.5333}{1.0} = 2.5333\n",
    "$$\n",
    "\n",
    "这意味着$A = 0.3667 + 2.5333 = 2.9$。\n",
    "（插图）\n",
    "\n",
    "\n",
    "从上图可以看出，我们每一次训练的结果都是根据最后一次训练样本进行匹配的，并没有考虑到之前的训练样本。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x899cb70>]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\r\n",
       "<svg height=\"250.465pt\" version=\"1.1\" viewBox=\"0 0 378.7 250.465\" width=\"378.7pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       " <defs>\r\n",
       "  <style type=\"text/css\">\r\n",
       "*{stroke-linecap:butt;stroke-linejoin:round;}\r\n",
       "  </style>\r\n",
       " </defs>\r\n",
       " <g id=\"figure_1\">\r\n",
       "  <g id=\"patch_1\">\r\n",
       "   <path d=\"M 0 250.465 \r\n",
       "L 378.7 250.465 \r\n",
       "L 378.7 0 \r\n",
       "L 0 0 \r\n",
       "z\r\n",
       "\" style=\"fill:none;\"/>\r\n",
       "  </g>\r\n",
       "  <g id=\"axes_1\">\r\n",
       "   <g id=\"patch_2\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "L 29.2 10.7 \r\n",
       "z\r\n",
       "\" style=\"fill:#ffffff;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"PathCollection_1\">\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 0 3 \r\n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\n",
       "C 2.683901 1.55874 3 0.795609 3 0 \r\n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \r\n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \r\n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \r\n",
       "z\r\n",
       "\" id=\"m092886eaf7\" style=\"stroke:#1f77b4;\"/>\r\n",
       "    </defs>\r\n",
       "    <g clip-path=\"url(#p9b15a6ed99)\">\r\n",
       "     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"112.9\" xlink:href=\"#m092886eaf7\" y=\"65.06\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"PathCollection_2\">\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 0 3 \r\n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\n",
       "C 2.683901 1.55874 3 0.795609 3 0 \r\n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \r\n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \r\n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \r\n",
       "z\r\n",
       "\" id=\"m0afa4a796e\" style=\"stroke:#ff7f0e;\"/>\r\n",
       "    </defs>\r\n",
       "    <g clip-path=\"url(#p9b15a6ed99)\">\r\n",
       "     <use style=\"fill:#ff7f0e;stroke:#ff7f0e;\" x=\"280.3\" xlink:href=\"#m0afa4a796e\" y=\"173.78\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_1\">\r\n",
       "    <g id=\"xtick_1\">\r\n",
       "     <g id=\"line2d_1\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L 0 3.5 \r\n",
       "\" id=\"mad9bb087d0\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mad9bb087d0\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_1\">\r\n",
       "      <!-- 0.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 3.125 29.296875 \r\n",
       "Q 3.90625 50 6.4375 56.046875 \r\n",
       "Q 8.984375 62.109375 13.671875 66.015625 \r\n",
       "Q 18.359375 69.921875 25.1875 69.921875 \r\n",
       "Q 32.03125 69.921875 37.109375 64.25 \r\n",
       "Q 42.1875 58.59375 43.75 50 \r\n",
       "Q 45.3125 41.40625 44.71875 30.265625 \r\n",
       "Q 44.140625 19.140625 40.8125 12.109375 \r\n",
       "Q 37.5 5.078125 30.859375 2.34375 \r\n",
       "Q 24.21875 -0.390625 17.578125 2.921875 \r\n",
       "Q 10.9375 6.25 8.203125 11.71875 \r\n",
       "Q 5.46875 17.1875 4.296875 23.234375 \r\n",
       "Q 3.125 29.296875 3.90625 50 \r\n",
       "z\r\n",
       "M 12.890625 52.734375 \r\n",
       "Q 10.546875 31.25 12.5 22.84375 \r\n",
       "Q 14.453125 14.453125 18.9375 10.9375 \r\n",
       "Q 23.4375 7.421875 28.125 9.5625 \r\n",
       "Q 32.8125 11.71875 34.953125 18.15625 \r\n",
       "Q 37.109375 24.609375 37.109375 32.21875 \r\n",
       "Q 37.109375 39.84375 36.515625 46.09375 \r\n",
       "Q 35.9375 52.34375 33 57.421875 \r\n",
       "Q 30.078125 62.5 25.1875 62.6875 \r\n",
       "Q 20.3125 62.890625 16.59375 57.8125 \r\n",
       "Q 12.890625 52.734375 10.546875 31.25 \r\n",
       "z\r\n",
       "\" id=\"SimHei-48\"/>\r\n",
       "       <path d=\"M 16.796875 1.953125 \r\n",
       "L 7.8125 1.953125 \r\n",
       "L 7.8125 10.546875 \r\n",
       "L 16.796875 10.546875 \r\n",
       "z\r\n",
       "\" id=\"SimHei-46\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(21.7 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_2\">\r\n",
       "     <g id=\"line2d_2\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"71.05\" xlink:href=\"#mad9bb087d0\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_2\">\r\n",
       "      <!-- 0.5 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 8.59375 20.703125 \r\n",
       "Q 11.328125 10.15625 17.96875 8.984375 \r\n",
       "Q 24.609375 7.8125 28.703125 10.34375 \r\n",
       "Q 32.8125 12.890625 34.5625 16.984375 \r\n",
       "Q 36.328125 21.09375 36.125 26.171875 \r\n",
       "Q 35.9375 31.25 33.390625 34.765625 \r\n",
       "Q 30.859375 38.28125 26.953125 39.453125 \r\n",
       "Q 23.046875 40.625 18.15625 39.453125 \r\n",
       "Q 13.28125 38.28125 10.15625 33.984375 \r\n",
       "L 3.515625 34.765625 \r\n",
       "Q 4.296875 37.109375 10.9375 68.359375 \r\n",
       "L 41.796875 68.359375 \r\n",
       "L 41.796875 61.328125 \r\n",
       "L 16.796875 61.328125 \r\n",
       "Q 14.84375 50.78125 12.890625 44.53125 \r\n",
       "Q 18.75 47.265625 23.828125 47.0625 \r\n",
       "Q 28.90625 46.875 33.59375 44.71875 \r\n",
       "Q 38.28125 42.578125 40.421875 38.859375 \r\n",
       "Q 42.578125 35.15625 43.546875 31.4375 \r\n",
       "Q 44.53125 27.734375 44.328125 23.4375 \r\n",
       "Q 44.140625 19.140625 42.578125 14.640625 \r\n",
       "Q 41.015625 10.15625 37.890625 7.21875 \r\n",
       "Q 34.765625 4.296875 30.265625 2.53125 \r\n",
       "Q 25.78125 0.78125 19.921875 1.171875 \r\n",
       "Q 14.0625 1.5625 8.78125 5.46875 \r\n",
       "Q 3.515625 9.375 1.5625 18.75 \r\n",
       "z\r\n",
       "\" id=\"SimHei-53\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(63.55 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_3\">\r\n",
       "     <g id=\"line2d_3\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"112.9\" xlink:href=\"#mad9bb087d0\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_3\">\r\n",
       "      <!-- 1.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 21.875 56.25 \r\n",
       "Q 16.796875 51.171875 8.984375 46.484375 \r\n",
       "L 8.984375 53.90625 \r\n",
       "Q 18.75 60.546875 25 69.53125 \r\n",
       "L 29.6875 69.53125 \r\n",
       "L 29.6875 2.34375 \r\n",
       "L 21.875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-49\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(105.4 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_4\">\r\n",
       "     <g id=\"line2d_4\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"154.75\" xlink:href=\"#mad9bb087d0\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_4\">\r\n",
       "      <!-- 1.5 -->\r\n",
       "      <g transform=\"translate(147.25 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_5\">\r\n",
       "     <g id=\"line2d_5\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"196.6\" xlink:href=\"#mad9bb087d0\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_5\">\r\n",
       "      <!-- 2.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 4.6875 3.90625 \r\n",
       "Q 5.078125 9.765625 10.15625 14.453125 \r\n",
       "Q 15.234375 19.140625 23.046875 29.09375 \r\n",
       "Q 30.859375 39.0625 33.203125 44.53125 \r\n",
       "Q 35.546875 50 34.953125 53.90625 \r\n",
       "Q 34.375 57.8125 31.25 60.34375 \r\n",
       "Q 28.125 62.890625 24.015625 62.5 \r\n",
       "Q 19.921875 62.109375 16.203125 59.375 \r\n",
       "Q 12.5 56.640625 10.546875 51.171875 \r\n",
       "L 3.125 52.34375 \r\n",
       "Q 6.25 61.328125 11.125 65.421875 \r\n",
       "Q 16.015625 69.53125 22.65625 69.921875 \r\n",
       "Q 26.5625 70.3125 29.6875 69.71875 \r\n",
       "Q 32.8125 69.140625 36.125 66.984375 \r\n",
       "Q 39.453125 64.84375 41.59375 60.546875 \r\n",
       "Q 43.75 56.25 43.15625 50.1875 \r\n",
       "Q 42.578125 44.140625 37.109375 35.734375 \r\n",
       "Q 31.640625 27.34375 16.015625 9.375 \r\n",
       "L 44.140625 9.375 \r\n",
       "L 44.140625 2.34375 \r\n",
       "L 4.6875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-50\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(189.1 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_6\">\r\n",
       "     <g id=\"line2d_6\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"238.45\" xlink:href=\"#mad9bb087d0\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_6\">\r\n",
       "      <!-- 2.5 -->\r\n",
       "      <g transform=\"translate(230.95 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_7\">\r\n",
       "     <g id=\"line2d_7\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"280.3\" xlink:href=\"#mad9bb087d0\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_7\">\r\n",
       "      <!-- 3.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 3.90625 19.140625 \r\n",
       "L 10.9375 20.3125 \r\n",
       "Q 12.5 15.234375 16.015625 11.90625 \r\n",
       "Q 19.53125 8.59375 24.796875 8.78125 \r\n",
       "Q 30.078125 8.984375 33.203125 13.078125 \r\n",
       "Q 36.328125 17.1875 35.9375 22.453125 \r\n",
       "Q 35.546875 27.734375 31.828125 30.65625 \r\n",
       "Q 28.125 33.59375 19.921875 34.765625 \r\n",
       "L 19.921875 39.84375 \r\n",
       "Q 28.125 40.625 31.828125 44.140625 \r\n",
       "Q 35.546875 47.65625 35.15625 53.3125 \r\n",
       "Q 34.765625 58.984375 30.078125 61.515625 \r\n",
       "Q 25.390625 64.0625 20.109375 62.109375 \r\n",
       "Q 14.84375 60.15625 11.71875 51.171875 \r\n",
       "L 4.6875 52.34375 \r\n",
       "Q 7.03125 59.375 11.125 64.0625 \r\n",
       "Q 15.234375 68.75 22.265625 69.53125 \r\n",
       "Q 29.296875 70.3125 34.5625 67.765625 \r\n",
       "Q 39.84375 65.234375 41.984375 59.953125 \r\n",
       "Q 44.140625 54.6875 42.578125 48.4375 \r\n",
       "Q 41.015625 42.1875 33.59375 37.5 \r\n",
       "Q 39.0625 35.15625 41.984375 30.46875 \r\n",
       "Q 44.921875 25.78125 43.9375 18.15625 \r\n",
       "Q 42.96875 10.546875 37.109375 5.859375 \r\n",
       "Q 31.25 1.171875 23.828125 1.359375 \r\n",
       "Q 16.40625 1.5625 10.9375 6.046875 \r\n",
       "Q 5.46875 10.546875 3.90625 19.140625 \r\n",
       "z\r\n",
       "\" id=\"SimHei-51\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(272.8 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_8\">\r\n",
       "     <g id=\"line2d_8\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"322.15\" xlink:href=\"#mad9bb087d0\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_8\">\r\n",
       "      <!-- 3.5 -->\r\n",
       "      <g transform=\"translate(314.65 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_9\">\r\n",
       "     <g id=\"line2d_9\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"364\" xlink:href=\"#mad9bb087d0\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_9\">\r\n",
       "      <!-- 4.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 31.25 17.1875 \r\n",
       "L 1.171875 17.1875 \r\n",
       "L 1.171875 23.828125 \r\n",
       "L 32.8125 69.53125 \r\n",
       "L 38.671875 69.53125 \r\n",
       "L 38.671875 23.828125 \r\n",
       "L 48.046875 23.828125 \r\n",
       "L 48.046875 17.1875 \r\n",
       "L 38.671875 17.1875 \r\n",
       "L 38.671875 2.34375 \r\n",
       "L 31.25 2.34375 \r\n",
       "z\r\n",
       "M 31.25 23.828125 \r\n",
       "L 31.25 54.6875 \r\n",
       "L 9.375 23.828125 \r\n",
       "z\r\n",
       "\" id=\"SimHei-52\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(356.5 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-52\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_2\">\r\n",
       "    <g id=\"ytick_1\">\r\n",
       "     <g id=\"line2d_10\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L -3.5 0 \r\n",
       "\" id=\"m7a6cb76c6b\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m7a6cb76c6b\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_10\">\r\n",
       "      <!-- 0.0 -->\r\n",
       "      <g transform=\"translate(7.2 231.5775)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_2\">\r\n",
       "     <g id=\"line2d_11\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m7a6cb76c6b\" y=\"200.96\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_11\">\r\n",
       "      <!-- 0.5 -->\r\n",
       "      <g transform=\"translate(7.2 204.3975)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_3\">\r\n",
       "     <g id=\"line2d_12\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m7a6cb76c6b\" y=\"173.78\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_12\">\r\n",
       "      <!-- 1.0 -->\r\n",
       "      <g transform=\"translate(7.2 177.2175)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_4\">\r\n",
       "     <g id=\"line2d_13\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m7a6cb76c6b\" y=\"146.6\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_13\">\r\n",
       "      <!-- 1.5 -->\r\n",
       "      <g transform=\"translate(7.2 150.0375)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_5\">\r\n",
       "     <g id=\"line2d_14\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m7a6cb76c6b\" y=\"119.42\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_14\">\r\n",
       "      <!-- 2.0 -->\r\n",
       "      <g transform=\"translate(7.2 122.8575)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_6\">\r\n",
       "     <g id=\"line2d_15\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m7a6cb76c6b\" y=\"92.24\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_15\">\r\n",
       "      <!-- 2.5 -->\r\n",
       "      <g transform=\"translate(7.2 95.6775)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_7\">\r\n",
       "     <g id=\"line2d_16\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m7a6cb76c6b\" y=\"65.06\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_16\">\r\n",
       "      <!-- 3.0 -->\r\n",
       "      <g transform=\"translate(7.2 68.4975)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_8\">\r\n",
       "     <g id=\"line2d_17\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m7a6cb76c6b\" y=\"37.88\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_17\">\r\n",
       "      <!-- 3.5 -->\r\n",
       "      <g transform=\"translate(7.2 41.3175)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-51\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_9\">\r\n",
       "     <g id=\"line2d_18\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#m7a6cb76c6b\" y=\"10.7\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_18\">\r\n",
       "      <!-- 4.0 -->\r\n",
       "      <g transform=\"translate(7.2 14.1375)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-52\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"line2d_19\">\r\n",
       "    <path clip-path=\"url(#p9b15a6ed99)\" d=\"M 29.2 228.14 \r\n",
       "L 112.9 214.55 \r\n",
       "L 196.6 200.96 \r\n",
       "L 280.3 187.37 \r\n",
       "L 364 173.78 \r\n",
       "\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:square;stroke-width:1.5;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"line2d_20\">\r\n",
       "    <path clip-path=\"url(#p9b15a6ed99)\" d=\"M 29.2 228.14 \r\n",
       "L 112.9 208.206188 \r\n",
       "L 196.6 188.272376 \r\n",
       "L 280.3 168.338564 \r\n",
       "L 364 148.404752 \r\n",
       "\" style=\"fill:none;stroke:#ff7f0e;stroke-linecap:square;stroke-width:1.5;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"line2d_21\">\r\n",
       "    <path clip-path=\"url(#p9b15a6ed99)\" d=\"M 29.2 228.14 \r\n",
       "L 112.9 70.496 \r\n",
       "L 150.860311 -1 \r\n",
       "\" style=\"fill:none;stroke:#2ca02c;stroke-linecap:square;stroke-width:1.5;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_3\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 29.2 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_4\">\r\n",
       "    <path d=\"M 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_5\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_6\">\r\n",
       "    <path d=\"M 29.2 10.7 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_7\">\r\n",
       "    <path d=\"M 150.935709 82.505489 \r\n",
       "Q 132.826728 74.199609 115.733986 66.359838 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "    <path d=\"M 118.535993 69.845345 \r\n",
       "L 115.733986 66.359838 \r\n",
       "L 120.203595 66.209537 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"text_19\">\r\n",
       "    <!-- 瓢虫 -->\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 59.765625 70.703125 \r\n",
       "Q 59.765625 36.71875 58.984375 26.953125 \r\n",
       "Q 58.203125 17.1875 56.640625 8.203125 \r\n",
       "Q 55.078125 -0.78125 50.78125 -10.546875 \r\n",
       "Q 46.875 -7.8125 42.96875 -7.03125 \r\n",
       "Q 49.21875 0 51.359375 16.40625 \r\n",
       "Q 53.515625 32.8125 53.515625 50 \r\n",
       "L 53.515625 75 \r\n",
       "Q 61.71875 75.390625 72.265625 77.140625 \r\n",
       "Q 82.8125 78.90625 87.109375 82.03125 \r\n",
       "Q 89.453125 77.734375 92.578125 74.21875 \r\n",
       "Q 88.28125 73.828125 82.8125 72.65625 \r\n",
       "Q 83.203125 44.53125 84.765625 33.59375 \r\n",
       "Q 86.328125 22.65625 88.671875 12.6875 \r\n",
       "Q 91.015625 2.734375 96.875 -5.859375 \r\n",
       "Q 91.796875 -6.640625 89.453125 -9.765625 \r\n",
       "Q 83.984375 0.78125 81.046875 15.8125 \r\n",
       "Q 78.125 30.859375 77.34375 43.546875 \r\n",
       "Q 76.5625 56.25 76.5625 71.875 \r\n",
       "Q 73.046875 71.484375 71.09375 71.484375 \r\n",
       "L 71.09375 2.34375 \r\n",
       "L 74.609375 3.515625 \r\n",
       "Q 73.4375 7.421875 72.265625 9.375 \r\n",
       "Q 75 10.546875 77.34375 11.71875 \r\n",
       "Q 79.296875 8.203125 81.25 3.703125 \r\n",
       "Q 83.203125 -0.78125 84.765625 -4.296875 \r\n",
       "L 78.515625 -7.421875 \r\n",
       "Q 77.34375 -3.515625 76.5625 -1.5625 \r\n",
       "Q 68.75 -4.296875 65.234375 -7.03125 \r\n",
       "L 61.71875 -1.171875 \r\n",
       "Q 64.453125 0 64.84375 5.46875 \r\n",
       "L 64.84375 71.09375 \r\n",
       "Q 60.9375 70.703125 59.765625 70.703125 \r\n",
       "z\r\n",
       "M 6.25 77.34375 \r\n",
       "Q 10.9375 76.953125 15.625 76.953125 \r\n",
       "L 39.0625 76.953125 \r\n",
       "Q 44.140625 76.953125 48.828125 77.34375 \r\n",
       "L 48.828125 71.484375 \r\n",
       "Q 45.3125 71.875 35.9375 71.875 \r\n",
       "L 35.9375 62.5 \r\n",
       "L 48.4375 62.5 \r\n",
       "Q 48.046875 57.421875 48.046875 52.34375 \r\n",
       "Q 48.046875 47.265625 48.4375 41.40625 \r\n",
       "L 6.640625 41.40625 \r\n",
       "Q 7.03125 46.875 7.03125 51.5625 \r\n",
       "Q 7.03125 56.640625 6.640625 62.5 \r\n",
       "L 18.75 62.5 \r\n",
       "L 18.75 71.875 \r\n",
       "Q 10.9375 71.875 6.25 71.484375 \r\n",
       "z\r\n",
       "M 47.265625 17.578125 \r\n",
       "Q 43.359375 17.96875 38.671875 17.96875 \r\n",
       "L 31.25 17.96875 \r\n",
       "L 31.25 -3.515625 \r\n",
       "Q 31.25 -7.421875 28.125 -8.984375 \r\n",
       "Q 25 -10.546875 20.3125 -10.9375 \r\n",
       "Q 19.921875 -6.640625 17.578125 -3.125 \r\n",
       "Q 24.609375 -3.90625 25 -1.171875 \r\n",
       "L 25 17.96875 \r\n",
       "L 17.578125 17.96875 \r\n",
       "Q 12.5 17.96875 7.03125 17.578125 \r\n",
       "L 7.03125 23.828125 \r\n",
       "Q 12.890625 23.4375 17.578125 23.4375 \r\n",
       "L 38.671875 23.4375 \r\n",
       "Q 43.359375 23.4375 47.265625 23.828125 \r\n",
       "z\r\n",
       "M 35.15625 35.546875 \r\n",
       "Q 39.453125 35.546875 43.359375 35.9375 \r\n",
       "L 43.359375 29.296875 \r\n",
       "Q 39.453125 30.078125 35.15625 30.078125 \r\n",
       "L 19.921875 30.078125 \r\n",
       "Q 16.015625 30.078125 12.109375 29.296875 \r\n",
       "L 12.109375 35.9375 \r\n",
       "Q 16.015625 35.546875 19.53125 35.546875 \r\n",
       "z\r\n",
       "M 4.6875 -1.5625 \r\n",
       "Q 6.640625 0.390625 9.375 4.875 \r\n",
       "Q 12.109375 9.375 13.671875 13.28125 \r\n",
       "Q 16.015625 11.71875 19.921875 10.15625 \r\n",
       "Q 18.359375 7.8125 16.203125 4.296875 \r\n",
       "Q 14.0625 0.78125 10.15625 -5.078125 \r\n",
       "Q 7.8125 -3.125 4.6875 -1.5625 \r\n",
       "z\r\n",
       "M 41.40625 -1.171875 \r\n",
       "Q 38.28125 5.078125 33.984375 10.15625 \r\n",
       "Q 36.328125 11.71875 38.28125 14.0625 \r\n",
       "Q 43.75 7.8125 46.875 3.125 \r\n",
       "Q 44.140625 1.171875 41.40625 -1.171875 \r\n",
       "z\r\n",
       "M 30.078125 47.265625 \r\n",
       "L 30.078125 57.421875 \r\n",
       "L 24.609375 57.421875 \r\n",
       "L 24.609375 47.265625 \r\n",
       "z\r\n",
       "M 41.40625 47.265625 \r\n",
       "L 41.40625 57.421875 \r\n",
       "L 35.9375 57.421875 \r\n",
       "L 35.9375 47.265625 \r\n",
       "z\r\n",
       "M 18.75 47.265625 \r\n",
       "L 18.75 57.421875 \r\n",
       "L 13.671875 57.421875 \r\n",
       "L 13.671875 47.265625 \r\n",
       "z\r\n",
       "M 30.078125 62.5 \r\n",
       "L 30.078125 71.875 \r\n",
       "L 24.609375 71.875 \r\n",
       "L 24.609375 62.5 \r\n",
       "z\r\n",
       "\" id=\"SimHei-29922\"/>\r\n",
       "     <path d=\"M 44.921875 70.3125 \r\n",
       "Q 44.921875 74.609375 44.53125 80.46875 \r\n",
       "L 53.125 80.46875 \r\n",
       "Q 52.734375 75.78125 52.734375 70.703125 \r\n",
       "L 52.734375 60.546875 \r\n",
       "L 84.375 60.546875 \r\n",
       "Q 83.984375 52.34375 83.984375 46.09375 \r\n",
       "L 83.984375 33.984375 \r\n",
       "Q 83.984375 27.734375 84.375 20.703125 \r\n",
       "L 76.5625 20.703125 \r\n",
       "L 76.5625 24.609375 \r\n",
       "L 52.734375 24.609375 \r\n",
       "L 52.734375 2.734375 \r\n",
       "Q 67.1875 3.515625 78.90625 4.6875 \r\n",
       "Q 76.171875 9.375 72.265625 14.0625 \r\n",
       "Q 76.171875 16.015625 78.90625 18.359375 \r\n",
       "Q 87.890625 6.640625 96.09375 -5.078125 \r\n",
       "Q 90.625 -7.8125 87.890625 -9.765625 \r\n",
       "Q 85.546875 -5.46875 82.8125 -1.171875 \r\n",
       "Q 64.453125 -2.734375 54.875 -3.515625 \r\n",
       "Q 45.3125 -4.296875 34.171875 -5.265625 \r\n",
       "Q 23.046875 -6.25 7.421875 -8.59375 \r\n",
       "Q 5.46875 -2.34375 4.6875 0 \r\n",
       "Q 12.5 0 24.796875 0.78125 \r\n",
       "Q 37.109375 1.5625 44.921875 1.953125 \r\n",
       "L 44.921875 24.609375 \r\n",
       "L 21.09375 24.609375 \r\n",
       "L 21.09375 18.75 \r\n",
       "L 12.890625 18.75 \r\n",
       "Q 13.28125 25.78125 13.28125 33.203125 \r\n",
       "L 13.28125 46.875 \r\n",
       "Q 13.28125 53.125 12.890625 60.546875 \r\n",
       "L 44.921875 60.546875 \r\n",
       "z\r\n",
       "M 76.5625 31.25 \r\n",
       "L 76.5625 53.90625 \r\n",
       "L 52.734375 53.90625 \r\n",
       "L 52.734375 31.25 \r\n",
       "z\r\n",
       "M 44.921875 31.25 \r\n",
       "L 44.921875 53.90625 \r\n",
       "L 21.09375 53.90625 \r\n",
       "L 21.09375 31.25 \r\n",
       "z\r\n",
       "\" id=\"SimHei-34411\"/>\r\n",
       "    </defs>\r\n",
       "    <g transform=\"translate(154.75 92.24)scale(0.1 -0.1)\">\r\n",
       "     <use xlink:href=\"#SimHei-29922\"/>\r\n",
       "     <use x=\"100\" xlink:href=\"#SimHei-34411\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_8\">\r\n",
       "    <path d=\"M 319.333873 150.862774 \r\n",
       "Q 300.678188 161.815736 282.986648 172.202639 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "    <path d=\"M 287.448678 171.902154 \r\n",
       "L 282.986648 172.202639 \r\n",
       "L 285.423479 168.452724 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:round;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"text_20\">\r\n",
       "    <!-- 毛虫 -->\r\n",
       "    <defs>\r\n",
       "     <path d=\"M 81.25 71.09375 \r\n",
       "Q 74.609375 70.3125 69.140625 69.140625 \r\n",
       "Q 63.671875 67.96875 48.046875 65.234375 \r\n",
       "L 48.046875 49.609375 \r\n",
       "Q 54.6875 50.78125 78.125 55.078125 \r\n",
       "L 79.296875 47.65625 \r\n",
       "Q 57.03125 44.53125 48.4375 42.578125 \r\n",
       "L 48.4375 29.6875 \r\n",
       "Q 69.140625 32.421875 87.890625 35.9375 \r\n",
       "L 88.671875 27.734375 \r\n",
       "Q 69.140625 25.390625 48.4375 21.875 \r\n",
       "L 48.4375 5.078125 \r\n",
       "Q 48.4375 -1.171875 54.296875 -1.171875 \r\n",
       "L 75.390625 -1.171875 \r\n",
       "Q 79.296875 -1.171875 81.828125 1.75 \r\n",
       "Q 84.375 4.6875 85.15625 12.5 \r\n",
       "Q 89.0625 9.765625 94.140625 7.8125 \r\n",
       "Q 91.40625 -0.78125 88.671875 -3.90625 \r\n",
       "Q 85.9375 -7.03125 78.90625 -7.8125 \r\n",
       "L 51.5625 -7.8125 \r\n",
       "Q 40.625 -7.8125 40.625 2.734375 \r\n",
       "L 40.625 21.09375 \r\n",
       "Q 20.703125 17.96875 15.8125 17.1875 \r\n",
       "Q 10.9375 16.40625 6.25 15.625 \r\n",
       "L 5.078125 23.828125 \r\n",
       "Q 17.1875 25 26.359375 26.359375 \r\n",
       "Q 35.546875 27.734375 40.625 28.515625 \r\n",
       "L 40.625 41.796875 \r\n",
       "Q 22.65625 39.0625 13.28125 37.5 \r\n",
       "L 11.71875 45.3125 \r\n",
       "Q 18.75 45.703125 24.796875 46.484375 \r\n",
       "Q 30.859375 47.265625 40.234375 48.828125 \r\n",
       "L 40.234375 64.0625 \r\n",
       "Q 22.65625 61.71875 13.671875 60.9375 \r\n",
       "Q 12.890625 64.0625 10.9375 67.96875 \r\n",
       "Q 16.40625 67.96875 24.609375 68.75 \r\n",
       "Q 32.8125 69.53125 41.59375 71.09375 \r\n",
       "Q 50.390625 72.65625 60.546875 74.796875 \r\n",
       "Q 70.703125 76.953125 75.78125 79.296875 \r\n",
       "Q 77.734375 75 81.25 71.09375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-27611\"/>\r\n",
       "    </defs>\r\n",
       "    <g transform=\"translate(322.15 146.6)scale(0.1 -0.1)\">\r\n",
       "     <use xlink:href=\"#SimHei-27611\"/>\r\n",
       "     <use x=\"100\" xlink:href=\"#SimHei-34411\"/>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "  </g>\r\n",
       " </g>\r\n",
       " <defs>\r\n",
       "  <clipPath id=\"p9b15a6ed99\">\r\n",
       "   <rect height=\"217.44\" width=\"334.8\" x=\"29.2\" y=\"10.7\"/>\r\n",
       "  </clipPath>\r\n",
       " </defs>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "xs = [x for x in range(5)]\n",
    "ys = [insect_classfy(x, a=0.25) for x in xs]\n",
    "ys1 = [insect_classfy(x, a=0.3667) for x in xs]\n",
    "ys2 = [insect_classfy(x, a = 2.9) for x in xs]\n",
    "\n",
    "draw2insects()\n",
    "plt.plot(xs, ys)\n",
    "plt.plot(xs, ys1)\n",
    "plt.plot(xs, ys2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 适度改进（moderate）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "为了解决上面遇到的问题，我们可以采用机器学习中的一个重要概念，**适度改进**（moderate）。我们每次只向着训练样本所指示的方向改变一点点，保留先前训练迭代周期中的一部分。\n",
    "\n",
    "增加一个调节系数L，调节系数通常被称为**学习率**（learning rate）：\n",
    "$$\n",
    "\\Delta{A} = L \\frac {E}{x}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 分类器的局限性\n",
    "> 原文：1.5 有时候一个分类器不足以求解问题"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**布尔逻辑函数**通常需要两个输入，并输出一个答案。\n",
    "\n",
    "```mermaid\n",
    "    graph LR\n",
    "    A(输入值A) --> C(逻辑函数)\n",
    "    B(输入值B) --> C\n",
    "    C --> D(输出)\n",
    "```\n",
    "\n",
    "对于`AND`或`OR`函数，我们可以用形如$y = ax + b$的简单线性分类器，将输出结果为True或False给区分开。\n",
    "（p21图）\n",
    "（p22图）\n",
    "\n",
    "但是，对于`XOR`函数，我们没办法用一条简单的直线将两者划分开来。\n",
    "（p23）\n",
    "\n",
    "然而，我们可以**使用多个分类器一起工作，来解决这个问题，这就是神经网络的核心思想**。\n",
    "（p24）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 神经元——大自然的计算机器"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "生物大脑中的基本单元——神经元。\n",
    "\n",
    "**神经元的工作方式**\n",
    "\n",
    "神经元接受一个电输入，输出另一个电信号。但是，神经元不会立即反应，而是会抑制输入，知道输入增强，强大到达到一个阈值（threshold），才会触发输出。\n",
    "（p27）\n",
    "\n",
    "在数学上，有很多激活函数可以模拟上述效果，比如一个简单的**阶跃函数**：\n",
    "p27\n",
    "\n",
    "还有**S函数**（sigmoid function）：\n",
    "p28\n",
    "\n",
    "我们将使用S函数制造神经网络，S函数有时也称为**逻辑函数**：\n",
    "$$\n",
    "y = \\frac {1} {1 + e^(-x)}\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sigmoid(x):\n",
    "    \"\"\"\n",
    "    返回sigmoid function的计算结果\n",
    "    \"\"\"\n",
    "    y = 1 / (1 + np.e**(-x))\n",
    "    return y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x8cfd5c0>]"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Created with matplotlib (https://matplotlib.org/) -->\r\n",
       "<svg height=\"250.465pt\" version=\"1.1\" viewBox=\"0 0 374.7 250.465\" width=\"374.7pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       " <defs>\r\n",
       "  <style type=\"text/css\">\r\n",
       "*{stroke-linecap:butt;stroke-linejoin:round;}\r\n",
       "  </style>\r\n",
       " </defs>\r\n",
       " <g id=\"figure_1\">\r\n",
       "  <g id=\"patch_1\">\r\n",
       "   <path d=\"M 0 250.465 \r\n",
       "L 374.7 250.465 \r\n",
       "L 374.7 0 \r\n",
       "L 0 0 \r\n",
       "z\r\n",
       "\" style=\"fill:none;\"/>\r\n",
       "  </g>\r\n",
       "  <g id=\"axes_1\">\r\n",
       "   <g id=\"patch_2\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "L 29.2 10.7 \r\n",
       "z\r\n",
       "\" style=\"fill:#ffffff;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_1\">\r\n",
       "    <g id=\"xtick_1\">\r\n",
       "     <g id=\"line2d_1\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L 0 3.5 \r\n",
       "\" id=\"m1c0ab36413\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"44.418182\" xlink:href=\"#m1c0ab36413\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_1\">\r\n",
       "      <!-- -20 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 46.484375 33.203125 \r\n",
       "L 1.953125 33.203125 \r\n",
       "L 1.953125 39.453125 \r\n",
       "L 46.484375 39.453125 \r\n",
       "z\r\n",
       "\" id=\"SimHei-45\"/>\r\n",
       "       <path d=\"M 4.6875 3.90625 \r\n",
       "Q 5.078125 9.765625 10.15625 14.453125 \r\n",
       "Q 15.234375 19.140625 23.046875 29.09375 \r\n",
       "Q 30.859375 39.0625 33.203125 44.53125 \r\n",
       "Q 35.546875 50 34.953125 53.90625 \r\n",
       "Q 34.375 57.8125 31.25 60.34375 \r\n",
       "Q 28.125 62.890625 24.015625 62.5 \r\n",
       "Q 19.921875 62.109375 16.203125 59.375 \r\n",
       "Q 12.5 56.640625 10.546875 51.171875 \r\n",
       "L 3.125 52.34375 \r\n",
       "Q 6.25 61.328125 11.125 65.421875 \r\n",
       "Q 16.015625 69.53125 22.65625 69.921875 \r\n",
       "Q 26.5625 70.3125 29.6875 69.71875 \r\n",
       "Q 32.8125 69.140625 36.125 66.984375 \r\n",
       "Q 39.453125 64.84375 41.59375 60.546875 \r\n",
       "Q 43.75 56.25 43.15625 50.1875 \r\n",
       "Q 42.578125 44.140625 37.109375 35.734375 \r\n",
       "Q 31.640625 27.34375 16.015625 9.375 \r\n",
       "L 44.140625 9.375 \r\n",
       "L 44.140625 2.34375 \r\n",
       "L 4.6875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-50\"/>\r\n",
       "       <path d=\"M 3.125 29.296875 \r\n",
       "Q 3.90625 50 6.4375 56.046875 \r\n",
       "Q 8.984375 62.109375 13.671875 66.015625 \r\n",
       "Q 18.359375 69.921875 25.1875 69.921875 \r\n",
       "Q 32.03125 69.921875 37.109375 64.25 \r\n",
       "Q 42.1875 58.59375 43.75 50 \r\n",
       "Q 45.3125 41.40625 44.71875 30.265625 \r\n",
       "Q 44.140625 19.140625 40.8125 12.109375 \r\n",
       "Q 37.5 5.078125 30.859375 2.34375 \r\n",
       "Q 24.21875 -0.390625 17.578125 2.921875 \r\n",
       "Q 10.9375 6.25 8.203125 11.71875 \r\n",
       "Q 5.46875 17.1875 4.296875 23.234375 \r\n",
       "Q 3.125 29.296875 3.90625 50 \r\n",
       "z\r\n",
       "M 12.890625 52.734375 \r\n",
       "Q 10.546875 31.25 12.5 22.84375 \r\n",
       "Q 14.453125 14.453125 18.9375 10.9375 \r\n",
       "Q 23.4375 7.421875 28.125 9.5625 \r\n",
       "Q 32.8125 11.71875 34.953125 18.15625 \r\n",
       "Q 37.109375 24.609375 37.109375 32.21875 \r\n",
       "Q 37.109375 39.84375 36.515625 46.09375 \r\n",
       "Q 35.9375 52.34375 33 57.421875 \r\n",
       "Q 30.078125 62.5 25.1875 62.6875 \r\n",
       "Q 20.3125 62.890625 16.59375 57.8125 \r\n",
       "Q 12.890625 52.734375 10.546875 31.25 \r\n",
       "z\r\n",
       "\" id=\"SimHei-48\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(36.918182 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-45\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_2\">\r\n",
       "     <g id=\"line2d_2\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"83.439161\" xlink:href=\"#m1c0ab36413\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_2\">\r\n",
       "      <!-- -15 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 21.875 56.25 \r\n",
       "Q 16.796875 51.171875 8.984375 46.484375 \r\n",
       "L 8.984375 53.90625 \r\n",
       "Q 18.75 60.546875 25 69.53125 \r\n",
       "L 29.6875 69.53125 \r\n",
       "L 29.6875 2.34375 \r\n",
       "L 21.875 2.34375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-49\"/>\r\n",
       "       <path d=\"M 8.59375 20.703125 \r\n",
       "Q 11.328125 10.15625 17.96875 8.984375 \r\n",
       "Q 24.609375 7.8125 28.703125 10.34375 \r\n",
       "Q 32.8125 12.890625 34.5625 16.984375 \r\n",
       "Q 36.328125 21.09375 36.125 26.171875 \r\n",
       "Q 35.9375 31.25 33.390625 34.765625 \r\n",
       "Q 30.859375 38.28125 26.953125 39.453125 \r\n",
       "Q 23.046875 40.625 18.15625 39.453125 \r\n",
       "Q 13.28125 38.28125 10.15625 33.984375 \r\n",
       "L 3.515625 34.765625 \r\n",
       "Q 4.296875 37.109375 10.9375 68.359375 \r\n",
       "L 41.796875 68.359375 \r\n",
       "L 41.796875 61.328125 \r\n",
       "L 16.796875 61.328125 \r\n",
       "Q 14.84375 50.78125 12.890625 44.53125 \r\n",
       "Q 18.75 47.265625 23.828125 47.0625 \r\n",
       "Q 28.90625 46.875 33.59375 44.71875 \r\n",
       "Q 38.28125 42.578125 40.421875 38.859375 \r\n",
       "Q 42.578125 35.15625 43.546875 31.4375 \r\n",
       "Q 44.53125 27.734375 44.328125 23.4375 \r\n",
       "Q 44.140625 19.140625 42.578125 14.640625 \r\n",
       "Q 41.015625 10.15625 37.890625 7.21875 \r\n",
       "Q 34.765625 4.296875 30.265625 2.53125 \r\n",
       "Q 25.78125 0.78125 19.921875 1.171875 \r\n",
       "Q 14.0625 1.5625 8.78125 5.46875 \r\n",
       "Q 3.515625 9.375 1.5625 18.75 \r\n",
       "z\r\n",
       "\" id=\"SimHei-53\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(75.939161 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-45\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_3\">\r\n",
       "     <g id=\"line2d_3\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"122.46014\" xlink:href=\"#m1c0ab36413\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_3\">\r\n",
       "      <!-- -10 -->\r\n",
       "      <g transform=\"translate(114.96014 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-45\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_4\">\r\n",
       "     <g id=\"line2d_4\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"161.481119\" xlink:href=\"#m1c0ab36413\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_4\">\r\n",
       "      <!-- -5 -->\r\n",
       "      <g transform=\"translate(156.481119 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-45\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_5\">\r\n",
       "     <g id=\"line2d_5\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"200.502098\" xlink:href=\"#m1c0ab36413\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_5\">\r\n",
       "      <!-- 0 -->\r\n",
       "      <g transform=\"translate(198.002098 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_6\">\r\n",
       "     <g id=\"line2d_6\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"239.523077\" xlink:href=\"#m1c0ab36413\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_6\">\r\n",
       "      <!-- 5 -->\r\n",
       "      <g transform=\"translate(237.023077 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_7\">\r\n",
       "     <g id=\"line2d_7\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"278.544056\" xlink:href=\"#m1c0ab36413\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_7\">\r\n",
       "      <!-- 10 -->\r\n",
       "      <g transform=\"translate(273.544056 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_8\">\r\n",
       "     <g id=\"line2d_8\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"317.565035\" xlink:href=\"#m1c0ab36413\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_8\">\r\n",
       "      <!-- 15 -->\r\n",
       "      <g transform=\"translate(312.565035 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-53\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"xtick_9\">\r\n",
       "     <g id=\"line2d_9\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"356.586014\" xlink:href=\"#m1c0ab36413\" y=\"228.14\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_9\">\r\n",
       "      <!-- 20 -->\r\n",
       "      <g transform=\"translate(351.586014 242.015)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-50\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"matplotlib.axis_2\">\r\n",
       "    <g id=\"ytick_1\">\r\n",
       "     <g id=\"line2d_10\">\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 0 0 \r\n",
       "L -3.5 0 \r\n",
       "\" id=\"mdd9fa332eb\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n",
       "      </defs>\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mdd9fa332eb\" y=\"218.256364\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_10\">\r\n",
       "      <!-- 0.0 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 16.796875 1.953125 \r\n",
       "L 7.8125 1.953125 \r\n",
       "L 7.8125 10.546875 \r\n",
       "L 16.796875 10.546875 \r\n",
       "z\r\n",
       "\" id=\"SimHei-46\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(7.2 221.693864)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_2\">\r\n",
       "     <g id=\"line2d_11\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mdd9fa332eb\" y=\"178.721818\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_11\">\r\n",
       "      <!-- 0.2 -->\r\n",
       "      <g transform=\"translate(7.2 182.159318)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-50\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_3\">\r\n",
       "     <g id=\"line2d_12\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mdd9fa332eb\" y=\"139.187273\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_12\">\r\n",
       "      <!-- 0.4 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 31.25 17.1875 \r\n",
       "L 1.171875 17.1875 \r\n",
       "L 1.171875 23.828125 \r\n",
       "L 32.8125 69.53125 \r\n",
       "L 38.671875 69.53125 \r\n",
       "L 38.671875 23.828125 \r\n",
       "L 48.046875 23.828125 \r\n",
       "L 48.046875 17.1875 \r\n",
       "L 38.671875 17.1875 \r\n",
       "L 38.671875 2.34375 \r\n",
       "L 31.25 2.34375 \r\n",
       "z\r\n",
       "M 31.25 23.828125 \r\n",
       "L 31.25 54.6875 \r\n",
       "L 9.375 23.828125 \r\n",
       "z\r\n",
       "\" id=\"SimHei-52\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(7.2 142.624773)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-52\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_4\">\r\n",
       "     <g id=\"line2d_13\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mdd9fa332eb\" y=\"99.652727\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_13\">\r\n",
       "      <!-- 0.6 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 3.515625 19.53125 \r\n",
       "Q 4.296875 30.859375 6.046875 34.765625 \r\n",
       "Q 7.8125 38.671875 11.328125 44.53125 \r\n",
       "L 27.34375 69.53125 \r\n",
       "L 36.328125 69.53125 \r\n",
       "L 19.921875 43.75 \r\n",
       "Q 30.46875 46.484375 36.71875 42.96875 \r\n",
       "Q 42.96875 39.453125 45.109375 34.953125 \r\n",
       "Q 47.265625 30.46875 47.453125 25.1875 \r\n",
       "Q 47.65625 19.921875 45.890625 14.84375 \r\n",
       "Q 44.140625 9.765625 39.640625 5.65625 \r\n",
       "Q 35.15625 1.5625 27.140625 1.171875 \r\n",
       "Q 19.140625 0.78125 13.46875 4.09375 \r\n",
       "Q 7.8125 7.421875 5.65625 13.46875 \r\n",
       "Q 3.515625 19.53125 4.296875 30.859375 \r\n",
       "z\r\n",
       "M 12.5 16.015625 \r\n",
       "Q 19.53125 8.59375 25.390625 8.203125 \r\n",
       "Q 31.25 7.8125 35.15625 12.109375 \r\n",
       "Q 39.0625 16.40625 39.0625 24.609375 \r\n",
       "Q 39.0625 32.8125 34.171875 35.9375 \r\n",
       "Q 29.296875 39.0625 23.234375 38.28125 \r\n",
       "Q 17.1875 37.5 14.453125 32.421875 \r\n",
       "Q 11.71875 27.34375 12.109375 21.671875 \r\n",
       "Q 12.5 16.015625 19.53125 8.59375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-54\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(7.2 103.090227)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-54\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_5\">\r\n",
       "     <g id=\"line2d_14\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mdd9fa332eb\" y=\"60.118181\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_14\">\r\n",
       "      <!-- 0.8 -->\r\n",
       "      <defs>\r\n",
       "       <path d=\"M 2.734375 16.796875 \r\n",
       "Q 2.734375 26.171875 5.078125 30.65625 \r\n",
       "Q 7.421875 35.15625 12.890625 37.890625 \r\n",
       "Q 8.203125 40.625 6.640625 43.9375 \r\n",
       "Q 5.078125 47.265625 4.875 51.5625 \r\n",
       "Q 4.6875 55.859375 6.046875 58.984375 \r\n",
       "Q 7.421875 62.109375 10.15625 64.84375 \r\n",
       "Q 12.890625 67.578125 16.203125 68.546875 \r\n",
       "Q 19.53125 69.53125 23.4375 69.53125 \r\n",
       "Q 27.34375 69.53125 30.46875 68.75 \r\n",
       "Q 33.59375 67.96875 37.109375 65.421875 \r\n",
       "Q 40.625 62.890625 42.1875 58.203125 \r\n",
       "Q 43.75 53.515625 41.984375 47.265625 \r\n",
       "Q 40.234375 41.015625 32.8125 37.5 \r\n",
       "Q 39.453125 35.546875 42.1875 31.4375 \r\n",
       "Q 44.921875 27.34375 44.921875 21.484375 \r\n",
       "Q 44.921875 15.625 43.15625 12.109375 \r\n",
       "Q 41.40625 8.59375 39.25 6.25 \r\n",
       "Q 37.109375 3.90625 33.390625 2.53125 \r\n",
       "Q 29.6875 1.171875 24.015625 1.171875 \r\n",
       "Q 18.359375 1.171875 14.25 2.53125 \r\n",
       "Q 10.15625 3.90625 7.421875 6.640625 \r\n",
       "Q 4.6875 9.375 3.703125 13.078125 \r\n",
       "Q 2.734375 16.796875 2.734375 26.171875 \r\n",
       "z\r\n",
       "M 10.9375 26.5625 \r\n",
       "Q 10.546875 17.1875 12.296875 13.671875 \r\n",
       "Q 14.0625 10.15625 18.75 9.171875 \r\n",
       "Q 23.4375 8.203125 28.515625 9.375 \r\n",
       "Q 33.59375 10.546875 35.546875 14.84375 \r\n",
       "Q 37.5 19.140625 36.90625 23.4375 \r\n",
       "Q 36.328125 27.734375 32.03125 30.65625 \r\n",
       "Q 27.734375 33.59375 22.65625 33.203125 \r\n",
       "Q 17.578125 32.8125 14.25 29.6875 \r\n",
       "Q 10.9375 26.5625 10.546875 17.1875 \r\n",
       "z\r\n",
       "M 12.109375 56.25 \r\n",
       "Q 12.109375 48.4375 14.84375 44.921875 \r\n",
       "Q 17.578125 41.40625 23.4375 41.40625 \r\n",
       "Q 29.296875 41.40625 32.21875 44.921875 \r\n",
       "Q 35.15625 48.4375 34.953125 53.3125 \r\n",
       "Q 34.765625 58.203125 31.4375 60.546875 \r\n",
       "Q 28.125 62.890625 22.453125 62.5 \r\n",
       "Q 16.796875 62.109375 14.453125 59.171875 \r\n",
       "Q 12.109375 56.25 12.109375 48.4375 \r\n",
       "z\r\n",
       "\" id=\"SimHei-56\"/>\r\n",
       "      </defs>\r\n",
       "      <g transform=\"translate(7.2 63.555681)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-48\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-56\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "    <g id=\"ytick_6\">\r\n",
       "     <g id=\"line2d_15\">\r\n",
       "      <g>\r\n",
       "       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"29.2\" xlink:href=\"#mdd9fa332eb\" y=\"20.583635\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "     <g id=\"text_15\">\r\n",
       "      <!-- 1.0 -->\r\n",
       "      <g transform=\"translate(7.2 24.021135)scale(0.1 -0.1)\">\r\n",
       "       <use xlink:href=\"#SimHei-49\"/>\r\n",
       "       <use x=\"50\" xlink:href=\"#SimHei-46\"/>\r\n",
       "       <use x=\"100\" xlink:href=\"#SimHei-48\"/>\r\n",
       "      </g>\r\n",
       "     </g>\r\n",
       "    </g>\r\n",
       "   </g>\r\n",
       "   <g id=\"line2d_16\">\r\n",
       "    <path clip-path=\"url(#pa3d6e6405f)\" d=\"M 44.418182 218.256364 \r\n",
       "L 52.222378 218.256363 \r\n",
       "L 60.026573 218.256361 \r\n",
       "L 67.830769 218.256356 \r\n",
       "L 75.634965 218.256342 \r\n",
       "L 83.439161 218.256304 \r\n",
       "L 91.243357 218.2562 \r\n",
       "L 99.047552 218.255917 \r\n",
       "L 106.851748 218.25515 \r\n",
       "L 114.655944 218.253063 \r\n",
       "L 122.46014 218.24739 \r\n",
       "L 130.264336 218.231972 \r\n",
       "L 138.068531 218.190074 \r\n",
       "L 145.872727 218.076274 \r\n",
       "L 153.676923 217.767594 \r\n",
       "L 161.481119 216.93337 \r\n",
       "L 169.285315 214.700981 \r\n",
       "L 177.08951 208.881562 \r\n",
       "L 184.893706 194.693197 \r\n",
       "L 192.697902 165.093979 \r\n",
       "L 200.502098 119.42 \r\n",
       "L 208.306294 73.74602 \r\n",
       "L 216.11049 44.146802 \r\n",
       "L 223.914685 29.958437 \r\n",
       "L 231.718881 24.139018 \r\n",
       "L 239.523077 21.906629 \r\n",
       "L 247.327273 21.072405 \r\n",
       "L 255.131469 20.763725 \r\n",
       "L 262.935664 20.649925 \r\n",
       "L 270.73986 20.608027 \r\n",
       "L 278.544056 20.592609 \r\n",
       "L 286.348252 20.586937 \r\n",
       "L 294.152448 20.58485 \r\n",
       "L 301.956643 20.584082 \r\n",
       "L 309.760839 20.5838 \r\n",
       "L 317.565035 20.583696 \r\n",
       "L 325.369231 20.583658 \r\n",
       "L 333.173427 20.583643 \r\n",
       "L 340.977622 20.583638 \r\n",
       "L 348.781818 20.583636 \r\n",
       "\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:square;stroke-width:1.5;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_3\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 29.2 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_4\">\r\n",
       "    <path d=\"M 364 228.14 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_5\">\r\n",
       "    <path d=\"M 29.2 228.14 \r\n",
       "L 364 228.14 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "   <g id=\"patch_6\">\r\n",
       "    <path d=\"M 29.2 10.7 \r\n",
       "L 364 10.7 \r\n",
       "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n",
       "   </g>\r\n",
       "  </g>\r\n",
       " </g>\r\n",
       " <defs>\r\n",
       "  <clipPath id=\"pa3d6e6405f\">\r\n",
       "   <rect height=\"217.44\" width=\"334.8\" x=\"29.2\" y=\"10.7\"/>\r\n",
       "  </clipPath>\r\n",
       " </defs>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "xs = [x for x in range(-20, 20)]\n",
    "ys = [sigmoid(x) for x in xs]\n",
    "plt.plot(xs, ys)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**S函数模拟神经元的工作机制**\n",
    "p29\n",
    "\n",
    "**自然形式的神经元**\n",
    "（p30）\n",
    "\n",
    "**人造模型的神经元**\n",
    "p30\n",
    "可以看到三层神经元，每一层有三个人工神经元或节点，每个节点都与前一层或后续层的其他没一个节点相互连接。\n",
    "\n",
    "接下来的问题是，这个体系架构中：\n",
    "* 哪一部分能够执行学习功能呢？\n",
    "* 针对训练样本，我们应该如何调整做出反应呢？\n",
    "* 有没有和先前线性分类器中类似的参数供我们调整呢？\n",
    "\n",
    "从上面的神经元结构可以看出，我们有2个部分可以进行调整：\n",
    "* S阈值函数的形状\n",
    "* **节点之间的连接强度**\n",
    "\n",
    "但是，调节节点之间连接强度远比调节S阈值函数的形状简单得多，我们只需要为连接加上**权重**即可，因此我们选择了调节节点之间的连接强度。\n",
    "（p31）\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 在神经网络中追踪信号"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们先尝试使用只有两层、每层两个神经元的较小的神经网络，来演示神经网络如何工作。\n",
    "p33\n",
    "\n",
    "先设定2个输入值，再随机生成4个权重，如下图：\n",
    "p34"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 第一层"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "第一层节点是输入层，不做任何计算。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 第二层"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 第一个节点"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "第二层第一个节点：\n",
    "$$\n",
    "\\begin{split}\n",
    "x_1 &= 1.0 * 0.9 + 0.5 * 0.3 \\\\\n",
    "&= 1.05\n",
    "\\end{split}\n",
    "$$\n",
    "因此，第一个输出为：\n",
    "$$\n",
    "y_1 = \\frac {1} {1 + 0.3499} = 0.7408\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 第二个节点"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "第二层的第二个节点：\n",
    "$$\n",
    "x_2 = 1.0 * 0.2 + 0.5 * 0.8 = 0.6\n",
    "$$\n",
    "因此，第二个输出为：\n",
    "$$\n",
    "y_2 = \\frac {1} {1 + 0.5488} = 0.6457\n",
    "$$\n",
    "\n",
    "p36"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 矩阵乘法\n",
    "> 原文：1.8 凭心而论，矩阵乘法大有用途"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "前面的两层、每一层只有两节点的神经网络进行计算，对于人类而言，工作量已经足够大了。因此，我们需要**使用矩阵帮助我们简化计算**。\n",
    "\n",
    "**矩阵乘法的运算规则**\n",
    "> 此处所说的矩阵乘法表示**点乘**（dot product）或**内积**（inner product）。\n",
    "\n",
    "$$\n",
    "\\begin{pmatrix}\n",
    "a & b \\\\\n",
    "c & d\n",
    "\\end{pmatrix}\n",
    "\\begin{pmatrix}\n",
    "e & f \\\\\n",
    "g & h\n",
    "\\end{pmatrix}\n",
    "=\n",
    "\\begin{pmatrix}\n",
    "ae+bg & af+bh \\\\\n",
    "ce+dg & cf+dh\n",
    "\\end{pmatrix}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们将矩阵中的字母替换成对神经网络更有意义的单词：\n",
    "$$\n",
    "\\begin{pmatrix}\n",
    "W_{1,1} & W_{2,1} \\\\\n",
    "W_{1,2} & W_{2,2}\n",
    "\\end{pmatrix}\n",
    "\\begin{pmatrix}\n",
    "input_1 \\\\\n",
    "input_2\n",
    "\\end{pmatrix}\n",
    "=\n",
    "\\begin{pmatrix}\n",
    "W_{1,1} * input_1 + W_{2,1} * input_2 \\\\\n",
    "W_{1,2} * input_1 + W_{2,2} * input_2\n",
    "\\end{pmatrix}\n",
    "$$\n",
    "\n",
    "上面的矩阵相乘结果正好对应了之前的两层神经网络：\n",
    "p42"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "所以，两层神经网络的计算过程可以简洁地表示为：\n",
    "$$\n",
    "X = W \\cdot I\n",
    "$$\n",
    "> W是权重矩阵，I是输入矩阵，X是组合调节后的信号，即输入到第二层的结果矩阵。\n",
    "\n",
    "因此，来自第二层的最终输出是：\n",
    "$$\n",
    "O = sigmoid(X)\n",
    "$$\n",
    "> 矩阵O包含了神经网络的最后一层中的所有输出。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 使用矩阵乘法的三层神经网络示例"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如图所示三层神经网络：\n",
    "p44\n",
    "\n",
    "第一层为**输入层**，最后一层为**输出层**，中间层为**隐藏层**。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 输入层"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**输入矩阵I**为：\n",
    "$$\n",
    "I = \n",
    "\\begin{pmatrix}\n",
    "0.9 \\\\\n",
    "0.1 \\\\\n",
    "0.8\n",
    "\\end{pmatrix}\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [],
   "source": [
    "I = np.mat([0.9, 0.1, 0.8]).T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "matrix([[0.9],\n",
       "        [0.1],\n",
       "        [0.8]])"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "I"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 隐藏层"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "输入层和隐藏层之间的**权重矩阵W**为：\n",
    "$$\n",
    "W_{InputHidden} = \n",
    "\\begin{pmatrix}\n",
    "0.9 & 0.3 & 0.4 \\\\\n",
    "0.2 & 0.8 & 0.2 \\\\\n",
    "0.1 & 0.5 & 0.6\n",
    "\\end{pmatrix}\n",
    "$$\n",
    "> 注意：以上权重是随机列举的，并无特殊含义。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [],
   "source": [
    "W_input_hidden = np.mat([[0.9, 0.3, 0.4],\n",
    "                         [0.2, 0.8, 0.2],\n",
    "                         [0.1, 0.5, 0.6]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "matrix([[0.9, 0.3, 0.4],\n",
       "        [0.2, 0.8, 0.2],\n",
       "        [0.1, 0.5, 0.6]])"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "W_input_hidden"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "隐藏层和输出层之间的**权重矩阵W**为：\n",
    "$$\n",
    "W_{HiddenOutput} = \n",
    "\\begin{pmatrix}\n",
    "0.3 & 0.7 & 0.5 \\\\\n",
    "0.6 & 0.5 & 0.2 \\\\\n",
    "0.8 & 0.1 & 0.9\n",
    "\\end{pmatrix}\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [],
   "source": [
    "W_hidden_output = np.mat([[0.3, 0.7, 0.5],\n",
    "                          [0.6, 0.5, 0.2],\n",
    "                          [0.8, 0.1, 0.9]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "matrix([[0.3, 0.7, 0.5],\n",
       "        [0.6, 0.5, 0.2],\n",
       "        [0.8, 0.1, 0.9]])"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "W_hidden_output"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 输入层到隐藏层"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "输入到隐藏层的输入值为：\n",
    "$$\n",
    "\\begin{split}\n",
    "X_{hidden} &= W_{InputHidden} \\cdot I \\\\\n",
    " &= \n",
    " \\begin{pmatrix}\n",
    "0.9 & 0.3 & 0.4 \\\\\n",
    "0.2 & 0.8 & 0.2 \\\\\n",
    "0.1 & 0.5 & 0.6\n",
    "\\end{pmatrix}\n",
    "\\cdot\n",
    "\\begin{pmatrix}\n",
    "0.9 \\\\\n",
    "0.1 \\\\\n",
    "0.8\n",
    "\\end{pmatrix} \\\\\n",
    "&=\n",
    "\\begin{pmatrix}\n",
    "1.16 \\\\\n",
    "0.42 \\\\\n",
    "0.62\n",
    "\\end{pmatrix}\n",
    "\\end{split}\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "matrix([[1.16],\n",
       "        [0.42],\n",
       "        [0.62]])"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_hidden = W_input_hidden * I\n",
    "X_hidden"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "应用S激活函数：\n",
    "$$\n",
    "\\begin{split}\n",
    "O_{hidden} &= sigmoid(X_{hidden}) \\\\\n",
    "&= sigmoid\n",
    "\\begin{pmatrix}\n",
    "1.16 \\\\\n",
    "0.42 \\\\\n",
    "0.62\n",
    "\\end{pmatrix} \\\\\n",
    "&=\\begin{pmatrix}\n",
    "0.761 \\\\\n",
    "0.603 \\\\\n",
    "0.650\n",
    "\\end{pmatrix}\n",
    "\\end{split}\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "unsupported operand type(s) for ** or pow(): 'float' and 'matrix'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-76-e4ce63312e75>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mO_hidden\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msigmoid\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mX_hidden\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      2\u001b[0m \u001b[0mO_hidden\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m<ipython-input-51-4e77e1049ed5>\u001b[0m in \u001b[0;36msigmoid\u001b[1;34m(x)\u001b[0m\n\u001b[0;32m      3\u001b[0m     \u001b[0m返回sigmoid\u001b[0m \u001b[0mfunction的计算结果\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      4\u001b[0m     \"\"\"\n\u001b[1;32m----> 5\u001b[1;33m     \u001b[0my\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m \u001b[1;33m/\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0me\u001b[0m\u001b[1;33m**\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m-\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      6\u001b[0m     \u001b[1;32mreturn\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for ** or pow(): 'float' and 'matrix'"
     ]
    }
   ],
   "source": [
    "# sigmoid函数应该怎么写，才能运算矩阵？？？？\n",
    "O_hidden = sigmoid(X_hidden)\n",
    "O_hidden"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "此时，神经网络应该变成：\n",
    "\n",
    "p48"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 隐藏层到输出层"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "不管是多少层神经网络，所有的操作都是一样，组合输入信号、应用链接权重调节输入信号、应用激活函数，生成这些层的输出信号。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$\n",
    "\\begin{split}\n",
    "X_{output} &= W_{HiddenOutput} \\cdot O_{hidden} \\\\\n",
    " &= \n",
    " \\begin{pmatrix}\n",
    "0.3 & 0.7 & 0.5 \\\\\n",
    "0.6 & 0.5 & 0.2 \\\\\n",
    "0.8 & 0.1 & 0.9\n",
    "\\end{pmatrix}\n",
    "\\cdot\n",
    "\\begin{pmatrix}\n",
    "0.761 \\\\\n",
    "0.603 \\\\\n",
    "0.650\n",
    "\\end{pmatrix} \\\\\n",
    "&=\n",
    "\\begin{pmatrix}\n",
    "0.975 \\\\\n",
    "0.888 \\\\\n",
    "1.254\n",
    "\\end{pmatrix}\n",
    "\\end{split}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "更新神经网络示意图：\n",
    "\n",
    "p49"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
